What are Data Structures, and why do we need them?

Klaven Jones
2 min readJul 12, 2021

What do software engineers do?

Well, a high-level description would be that all software engineers do is manipulate data. How do they do that?

By writing software.

And the backbone to every piece of software or program is data and algorithms.

An algorithm is a set of instructions we give to a program. An effective algorithm transforms data into something that a program or software uses efficiently.

For engineers to write efficient algorithms, they have to understand how to structure the data, so the algorithms they write maintain, utilize, and iterate through that data quickly.

That’s where data structures come into play.

A Data structure is a way to organize data, and its job is to store and retrieve it. Let’s think of a real-world example outside the scope of the digital world. Imagine if you went to a grocery store and found frozen pizza next to the bell peppers or toothpaste next to the milk. You’d be thinking to yourself how disorganized everything is in this store, and it makes shopping here a pretty chaotic experience.

Luckily, a good grocery store is laid out and stocked clearly for the customers, making the shopping experience a bit easier. Similarly, data structures provide us with a way to store data efficiently in a digital space.

How do we use Data Structures?

Data structures handle four main functions for us:

  • Inputting information
  • Processing information
  • Maintaining information
  • Retrieving information

The Inputting function primarily focuses on how the data is received. It determines what kind of data is received. It determines where the information is placed (Beginning, middle, or end of existing data). It decides if any current data needs to be updated or destroyed.

The Processing function primarily focuses on data manipulation in a data structure. Processing data can occur concurrently or due to other processes in data structures.

This function determines how to handle the stored data after existing data is either updated, removed, or added to the data structure.

The Maintaining function focuses on how to organize data within the structure. Which relationships need to maintain between pieces of data? How much memory must the system reserve (allocate) to accommodate the data?

The Retrieving function focuses on retrieving and returning that data stored in the structure. This function determines how information is accessed and the number of steps to retrieve that data in a given data structure.

There are many different data structures, all of which can perform these functions. But in some use cases, some may be better equipped than others to perform a specific task. It’s the engineer’s job to determine which data structure can complete the task more effectively, or else that code can be unresponsive and may even break the program. I won’t discuss how engineers determine which ones to use in this article; I’ll go more in-depth into that when talking about the most common data structures.

Data structures are the necessary building blocks for organizing data. Choosing the proper data structure is pivotal in writing good code.

References:

Codecademy — Why Data Structures?

--

--