What is a data structure?

Before we begin our study of what a data structure is, let us look at how the Wikipedia Page for Data Structure defines it.

A data structure is a data organization, management and storage format that enables efficient access and modification. More precisely, 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.

That is quite a lot of information to be grabbed at the first place. Let us try to list a few information out of the same.

  • A data structure is storage format.
  • It is a collection of data.
  • It enables data access.
  • It allows data modification.
  • It establishes relationship among the data.
  • It specifies the operations that can be applied to the data.

Let us now try to write a humanized version of the wikipedia definition.

A data structure is a container (like a basket) which holds one or more data values (like fruits). It specifies how a value can be pushed (inserted) into it, how a particular value contained in it can be read (retrieved), how a value can be modified (updated or deleted). A data structure also mentions how the data in the container are related to each other and what sorts of operations can be performed on it.

A data structure can be seen as a basket which can be used to keep one or more fruits or just keep it empty if we wish. Here, a fruit is analogous to data and the basket (container) to the data-structure.

  • data => A single fruit
  • data-structure => basket

Let's be a fruit-seller

(That is an un-expected heading. Isn't it? ;) )

orange fruits on basket

Now, I want you to assume yourself as a fruit-seller. Depending on the month, you sell a variety of fruits - Apple, Watermelon, Orange, Pear, Cherry, Strawberry, Nectarine, Grape, Mango, Blueberry and Pomegranate.

I want you to answer these questions in your mind.

  1. What size of basket will you choose for selling 10 kilograms of Grapes?
  2. What size of basket will you choose for selling 10 pieces Watermelon?
  3. Will your choice of basket depend on the fruit you are selling?
  4. Will your choice of basket depend on the amount and size of fruit you sell?
  5. Will your choice of basket depend on the number and variety of basket available to you?
  6. What type and size of basket will you choose to arrange fruits in your basket if you have to sell two (or sometimes more) types of fruits, say, Oranges and Apples?
  7. ...

Did you notice that your choice of basket depends on a lot of factors along with the type(s) of fruits, amount of fruits and also on the number of already available basket to you? That is exactly the same point I was trying to make.

The Basket and Data Structure Analogy

We have learnt from our fruit-seller activity that we can use different types of basket to keep our fruits or we can use one basket for all fruits. The choice of basket we make makes a lot of difference. The choice of basket is also dependent on the availability of basket.

A poor fruit seller may use a single basket for all fruits. This is comparable to a programmer who knows one and only one data-structure to keep all sorts of data.

A rich fruit seller who has all sorts of baskets may still use one basket for all because other baskets are, well, far away from him. You can compare this situation to case when you know advanced data-structures but opt for basic ones because you don't have time to implement those complex logic in limited time.

Just as the fruit-seller decides the basket she uses, the programmar is also free to use the data-struture(s) of her choice.

Just as the fruit-seller wants to maximise the profit, a programmar also wants to run her program/application in minimum possible time and make efficient use of the available resources.


A data structure is a container where we keep our data. There are a number of types of data-structures and our choice of a particular structure to keep our data values depends on a lot of factors. Depending on the data-structure being used, the ease of insert, retrieve, update and delete values in/from it varies.

If existing data-structures does not suit our needs, we can create new data-structure with or without using the existing ones.

Note : You might not understand a lot of information here in one go. Don't worry, once you read all the articles in this series, you should be able to catch up with most of them.

Author image
New Delhi
I am a passionate programmer based in New Delhi, India. I mostly work with Python. Apart from work, I find myself doing poetry and learning about various languages. I prefer chai over coffee.