What are Data Structures?

Jerome Chua
3 min readApr 27, 2021

--

Why Data Structures?

Before understanding the “What”, it would be good to understand the “Why”.

In my opinion, the digital often represents the physical. Data structures mirror reality.

How so? For example, when queuing up do buy popcorn, it would be pretty messed up if someone cut your queue. The feeling sucks only because in your mind you already have a representation of how the process of getting your popcorn should look like.

First come, first serve — then you leave the queue.

Well, similarly in computer science, a Queue data structure, models this reality. It has an ordering property known as FIFO (first-in, first-out). FIFO is also used in accounting methods.

Now, think about a time when you sent something for printing in your office or school. If there were others that sent their documents for printing earlier than you, the printer’s “system” would print theirs first.

How did the printer know? Well, a Queue data structure had been implemented within the system along with other algorithms (set of steps to let the computer or system know what to do).

Resource: https://blog.bytebytego.com

What are Data Structures?

Data structures are ways to organise and store concrete representations of data that can be used effectively.

Here they are split into 3 points for better understanding — Data structures represent/include:

  • A collection of data values
  • Relationships among data
  • Functions or operations that can be applied to the data

Different data structures have different properties and operations that can be performed on them, making them unique and varied.

Built-in Data Structures

In one of the more popular languages today, Python, we see that predecessors have made life easier by implementing built-in data structures within the Python language itself, they include:

  • List
  • Tuple
  • Dictionary
  • Set

Unique data operations can be performed on each of them. These operations that can be performed on these data structures have been implemented within the data structure itself.

Going back to the Queue example earlier, an operation to insert something into the middle of the Queue is not possible, because you can only insert things from the rear or the front, not in the middle.

Think about a Queue in real-life too, if you do this, you mess up the Queue, defeating the purpose of a Queue.

Primitive Data Structures

Primitive data structures are also built into languages. They are labelled as primitive because the structures mentioned above rely on all these primitive data structures to create more complex ones.

I think of them as basic building blocks for bigger things, like how musical notes (primitive) are part of a composition piece (computer program with lots of other data structures and algorithms).

Examples of primitive data structures

Resources:

Sandboxes

  • REPL
  • CodePen

Note Taking

  • MindNode
  • Notion
  • Obsidian

Practice

  • AlgoExpert
  • LeetCode

Getting Started

  • Cracking the Coding Interview [Java] (Book)
  • Essential Elements of Coding Interview in Python (Book)
  • Colt Steele’s JavaScript Algorithms & Data Structures (Online)
  • AlgoExpert (Online)
  • Big O (8min Video by Gayle Laakmann on Hackerrank YouTube)
  • Problem Solving with Algorithms and Data Structures using Python (Free Online Book)

--

--