Data structures let us organize data, so that we can find answers efficiently.

For example, say you had to find all legos of the color red in Figure 1. Which case would be faster?

Figure 1: Legos — unorganized v/s organized

The second case is faster because the legos are organized. Similarly, in computer science, data structures let us organize data for quick retrieval.

Let us look at some data structures and their use cases.

Map

Let’s say you visit a grocery store to buy bread. Which store would you prefer?

Suhani Singhal

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store