Is Data Struct about memory?
Tags: math, computerscience, datastructures, discuss
Published: 2023-08-27 19:41:36

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.


### Introduction

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](https://en.wikipedia.org/wiki/Data_structure#Language_support) is a way to organize, manage, and store data (yes, you can store things in math. If you think about [matrices](https://en.wikipedia.org/wiki/Matrix_(mathematics)) or [sets](https://en.wikipedia.org/wiki/Set_(mathematics)), 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](https://en.wikipedia.org/wiki/Boolean_algebra#Boolean_algebras).

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](https://en.wikipedia.org/wiki/Group_(mathematics)), a [ring](https://en.wikipedia.org/wiki/Ring_(mathematics)), an [algebra](https://en.wikipedia.org/wiki/Algebra_over_a_field), etc. If you want to dive into this topic, read [Algebraic Structures](https://en.wikipedia.org/wiki/Algebraic_structure).

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](https://en.wikipedia.org/wiki/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.

### Conclusion

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.