What is data structure and why do we need them?

Sai Prabhanj Turaga
3 min readApr 20, 2024

--

One sentence description of data structures would be that they are basically different ways of storing data on your computer. This definition might not be clear right now, so let me give you a more concrete example over here.

So let’s say we have a bunch of blocks over here and it can be easily seen that they are not organized. So if you want to choose a black block from here, we face a problem. We need to check all of them one by one to find out the black one.

Since these items are not in an organized way, selecting black one is time consuming and difficult.

Okay, let’s look at the organized way of these items.

What we have done over here. We have just taken the unorganized items from here and put them in an organized way. So selecting black block from this list is very easy and it takes less time to find. And when it comes to data structures, we are doing the same thing that we have done over here : organizing the items.

It’s very clear that all applications are dealing with data, so they do some operations based on given data. Before processing the data we have to organize the data in a certain way that makes the process very efficient. From a software application performance point of view, the efficiency and the performance of the software depends on how the data is stored, organized and grouped together during the program execution. Every day, during our daily lives, we can see various types of data structures.

They might be a crowd of people who want to get a ticket for the concert, but without an organized way it becomes almost impossible to get a ticket. The organized way for people to get a ticket is the queue, and this is also called queue data structure in computer science, which is the first in first out method.

So another example is imagine there are a bunch of books and you want to return them to the library. It’s obvious that without an organized way of ordering, we cannot carry these books.

On the other hand, if you order them in this way, it becomes easier to carry them and this reminds us of stack data structure in computer science. So this is first in last out method.

Okay, we understand that we use data structure to make our application very efficient, but the problem is that there are many different types of data structures.

So which one should we choose for the best performance of software or application? We will see them in next series of articles on DSA

This is the main reason why big companies like Google, Apple, Amazon and Facebook ask questions about the data structures and algorithm from their candidates during the interview process. A professional software developer has to know which data structure to choose for a particular app which has a direct effect on the performance.

So hopefully you have an idea of what data structure is now and how it affects our applications.

--

--