DEV Community

loading...
Cover image for What are Data Structures?
Basecamp Community

What are Data Structures?

Rishabh Singh ⚡
Updated on ・3 min read

If you are preparing for a coding interview, implement a new algorithm or maybe you simply wanna help yourself with your computer science academic curriculum, the knowledge of Data Structures is a must.

In this article, we will cover all the essential yet basic knowledge you need to get started learning Data Structures and in the following parts, we will take a deep dive into all the popular data structures to help you get familiar with them as fast as possible.

What is Coding - in simple terms?

If you are from a computer science background then you may already know quite a few things about what exactly coding is but talking in the simplest terms possible & in the term that's relevant to our topic, coding is nothing but manipulation of data.

Now, this may sound a little absurd to you but if you look closely all we do in coding is structure, organize & manage data, in short, all we do is deal with data in one or another way.

Simplifying this definition, we can say that data structures are a way to organize and manage data.

What is Data Structures?

We already saw what basically a data structure is, in simple terms. Now coming to a more generic definition, let's have a glance over the basic Wikipedia definition of Data Structures.

A data structure is a collection of data values, the relationships among them, and the functions or operations that can be applied to the data.

From this definition, we can extract 3 main points about Data Structures:

  • It is a collection of data values
  • There is a relationship among those data values
  • And there are certain operations that can be performed on them to manipulate it

Let's verify these points with an example of a simple one-dimensional array.

Don't worry if you know nothing about arrays right now, we are going to cover arrays in future parts of this series.

For now, you can refer to the Wikipedia definition here but basically, an array is a collection of data that usually belongs to the same type.

For example an array of numbers.

https://media.geeksforgeeks.org/wp-content/uploads/array-2.png

Now if you look closely at the above illustration, you will notice that an array can contain multiple units of data that usually belong to the same type. In this case, it is an array of alphabets.

Along with that, we have some notations below the array which starts from 0. These are called indexes and help us to access the values of the array at that specific index. You don't have to worry about the 3 digit numbers above the array as of now so let's arbitrarily ignore them.

Now coming back to our points, we can say that the first point is true since the array is a collection of data, the second point is true as well since there is a relationship between the data values which is described by the index number.

And we can definitely perform operations on the array to maybe delete an element, move an element, add a new element, etc. Hence the third point also ends up being true.

So you just saw how data structures like arrays fit well into the definition of data structures & follow the same fundamental points described.

Final Summary

A Data Structure is nothing but:

  • a collection of data
  • that data is somehow related to one another
  • & you can perform operations on it to manipulate it as per your needs

Support

Thank you so much for reading! I hope you learned something new today. Please leave a like, a lovely comment, or feedback & also consider following me as I regularly post useful & informative articles to help you become a better programmer.

If you like my work please consider Buying me a Coffee so that I can bring more projects, more articles for you.

https://dev-to-uploads.s3.amazonaws.com/i/5irx7eny4412etlwnc64.png

Also if you have any questions or doubts feel free to contact me on Twitter, LinkedIn & GitHub. Or you can also post a comment/discussion & I will try my best to help you :D

Discussion (0)