DEV Community

Cover image for Is Data Struct about memory?

Posted on

Is Data Struct about memory?

A principle that I try to follow is to think about obvious concepts. Since we are introduced to society, we meet with a lot of concepts that we don't even question. Some authoritary figure like a teacher or a parent tells us things that we just accept.

If you think about data structure, you can relate it immediately to memory. Today, I want to discuss why data structures are not only about memory.


For instance, let’s understand that we do not have any problem thinking about data structures to organize data in memory. The problem is never the idea that data structures are indifferent to implementation.

Data Structure is a way to organize, manage, and store data (yes, you can store things in math. If you think about matrices or sets, you can notice that is a way to organize data. In practice, store things is about to organize things). It is a collection of values that we can realize operations. In essence, it is an Algebraic Structure of data.

Algebraic Structure

An algebraic Structure is a set of elements with one or more operations that satisfy some specific properties (axioms). An example is Boolean Algebra, a set with two binary operations, union and intersection. You can follow this link to understand more about Boolean Algebra.

At this point, I want to highlight that algebraic structures are essentially about math. It describes the properties of a set of elements: a group, a ring, an algebra, etc. If you want to dive into this topic, read Algebraic Structures.

It is a big mistake to take an abstract and mathematical concept and reduce it to a simple implementation that needs physical and limited resources. You do not need any computer or memory to understand or use data structures. You need data. And data in math is just a set of elements.

Let's to think about computational models

The root of this problem is that you maybe don't know about computational models. It is a important step because if you think that in computer science we are using math to model computational problems, and computational problems are mathematical problems, you probably never will reduce any computational problem to a phisical and limited resource (like memory).

Computer science problems follow math problems, and we use math to model them. It means that the problem that you're trying to solve, can be modeled by a mathematical problem before you start to think about some computational implementation.


I hope that you understand that data structures are not only about memory. It is a mathematical concept that we use to model computational problems.

This text is a little talk about some ideas that I would like to share. I tried to give some references to help if you want to dive into this topic. Also, it's very important to think about obvious concepts and try to understand why the things are the way they are.

Top comments (0)