DEV Community

Cover image for Introduction to Data Structures...
Sanjeeban Mukhopadhyay
Sanjeeban Mukhopadhyay

Posted on


Introduction to Data Structures...

If there is one thing which you have heard while into programming, it is Data Structures and Algorithms or simply DSA. It plays a pivotal role if you are sitting for any Tech-Interviews. What types of Data Structure problems are asked in interviews is an important question, but for a beginner how to begin learning Data Structures is the most important question. In this blog we will be dealing with the latter.
Also relevant real life examples of the use of data structures are also included to invoke interest.

Now, What is Data?
Data is just any random number or character which in itself does not have any meaning. Data objects are considered mutually unrelated in space.

So, What is Data Structures?
-> The most easy definition would be : It is a way of storing data values so that they can be retrieved and used efficiently.
-> A more precise definition would be : It is a particular way of organising a collection of data values, so that information can be arranged, stored, processed & retrieved easily and efficiently.

Next Question will be : What are the Classifications of Data Structures?
A: Broadly Data Structures can be classified into 2 types -> Primitive and Non-Primitive. The Chart is given below.
Classification of Data Structures

Now, let us see in brief what each of these data structure means...

What are Primitive Data Structures?
A: It is a type of data structure that stores the data of only one type. Integers,Floats,Characters are examples of Primitive Data Structures.

What are Non-Primitive Data Structures?
A: It is a type of data structure that can store the data of multiple type. It is of two types -> Linear and Non-Linear.

Linear Data Structure -> In this type the data elements are stored in a linear way. It is a non-hierarchical way of storing data.

Linear Data Structures

  • Arrays : It is simply a collection of similar data types. Although various other modifications are present in different languages. In languages such as C, array elements occupy contiguous memory locations and the size is declared at compile time. Thus the term static relates to it.

  • Linked-List : It is a collection of nodes, which are randomly allocated in the memory i.e. Dynamically allocated. Each node contains the data field and the address of the next node. A pictoral representation is shown below:

Linked List representation
Fact : The music player in your smartphone is most probably using Linked List to fetch music for you.

  • Stacks : It is a type of linear data structure which follow the Last In First Out(LIFO) principle. Some operations which can be performed in Stack is : POP (to delete),PUSH( to insert),PEEK (display the top element). A pictoral representation of Stack is shown below:

Stack representation
Fact : Call logs, Notifications, Browsing History, all these are using stack data structures.

  • Queue : It is also a type of linear data structure which follow the First In First Out(FIFO) principle. Some operations which can be performed in Queue is : ENQUEUE (to insert),DEQUQE (to delete). A pictoral representation of Queue is shown below:

Queue representation
Fact : An Operating System uses queue to function and handle data.

Non-Linear Data Structures

In Non-Linear Data Structures, data elements are not arranged in a sequential order. It is a hierarchical way of storing data. Trees and Graphs are examples of this type of data structure.

  • Trees : It is a non-linear, hierarchical data structure consisting of a set of nodes, where each node contains a data value. Trees do not store data sequentially, thus is easier and faster to store and retrieve data. A pictoral representation of Tree is shown below:

Tree representation

Binary tree is a special type of tree where the data value in the node of the left subtree is always less than the root node and the data value in the node of the right subtree is always more than the root node.

Fact : My Files or any types of files on your computer most probably uses trees to maintain data.

  • Graph : A Graph can be defined as a set of vertices & edges. Vertices are also known as nodes. Edges connect two vertices/nodes.

Graph representation
Fact : Companies like Facebook, Google uses graph to store and retrieve data. GPS navigation also uses graph data structure.

Now we have covered a basic description of data structures. As a beginner this information might be a little overwhelming and seem difficult at first but as your practise increases, these seem like cakewalk. What we have discussed so far is very basic information and there is an ocean left to cover.
In case you are learning data structures in C language, I have a repository for you to refer.(

Thankyou for reading! See you in the next blog.

Connect with me :
Twitter ->
Linkedin ->

Top comments (0)

Regex for lazy developers

regex for lazy devs

You know who you are. Sorry for the callout 😆