Overview of Linear Data Structures

Harshitha Devi

February 28 2022

Data Structures and Algorithms (DSA) of any programming language consists of the same data structures to be learnt. I primarily work with Python and below is an overview of the linear data structures to be learnt.


NODES

The first data structure we have to tackle is Nodes. Nodes are the building blocks for many of the data structures to follow, and you will see them pop up many, many more times throughout the other data structures.


LINKED LISTS

Now that you are familiar with nodes, the next step is to actually use them to build something! Linking together nodes using their next_node property creates a singly linked list. Singly linked lists are extremely versatile and useful.


DOUBLY LINKED LISTS

While a singly linked list consists of nodes with links from one node to the next, a doubly linked list consists of links to the nodes before it as well. These prev_node links, along with the added tail_node property, allow you to iterate backwards also.


QUEUES

A queue is a linear collection of nodes that exclusively adds (enqueues) nodes to the tail, and removes (dequeues) nodes from the head of the queue. They can be implemented using different underlying data structures, but the most common method is to use a singly linked list. As the name suggests, this structure resembles a queue at any particular place and thus follows the First In First Out (FIFO) method.


STACKS

Stacks are another data structure with a perfectly descriptive name. Like a queue, a stack is also a linear collection of nodes that adds (pushes) data to the head, or top, of the stack and removes data (pops) from the head of the stack. Think of it as a stack of books, where you can only pick up the top book, and add a new book to the top. Thus, this structure follows the Last In First Out (LIFO) method.


ALGORITHMIC COMPLEXITY

As we begin to create these data structures and use them in algorithms, we eventually want to consider the efficiency of these algorithms. We do this with Asymptotic Notation. With asymptotic notation, we calculate a program’s runtime by looking at how many instructions the computer has to perform based on the size of the program’s input. This also helps us in determining the Space Complexity.


I will be diving into details of the knowledge I have gained regarding DSA in the upcoming blog posts.