What is a Data Structure?

What is a Data Structure?


In this article, Pratham has talked about the different characteristics of Data Structure, classification Of Data Structure, applications of Data Structures, and much more. Data structures enable programs to store and process data effectively. There are numerous data structures, each with its own set of benefits and drawbacks.

Read on to know more.

In today's competitive and challenging world, data is one of the most powerful tools available to any business or organization that wants to survive and rise to the top. The more information available, the more options and better solutions to problems and obstacles become available.

However, this data has some essential requirements, including keeping the information organized and accessible. All the data in the world will only help a business if it can access it and convert it into an actionable asset.

The data structure is the main part of computer science algorithms by which programmers can handle data well. It plays a vital role in improving the performance of the program or software.

What is Data Structure? 

The data structure is a way to store and organize data in a computer system so that we can use the data easily.

Its main operations are given below:-

  1. Searching – The process of finding an element is called searching. There are two algorithms to complete the search, the first binary search and the second linear search. 
  2. Sorting – The process of arranging the data structure in a particular order is called sorting. There are many algorithms to perform sorting, such as – insertion sort, selection sort, bubble sort, radix sort, etc. 
  3. Insertion – The process of adding elements to a location is called insertion. If the size of a data structure is n, then we can insert only n-1 elements in it. 
  4. Deletion – The process of removing an element is called deletion. We can delete data from any location we want. 
  5. Traversing – Traversing means traversing each data structure element to perform a particular task. 
  6. Merging – Joining two such lists which have the same type of data elements together is called merging. From this, we get a third list.

Characteristics of Data Structure

  1. Linear or Nonlinear: This is the order characteristic of the data structure. It arranges the data in a sequential form.
  2. Static or Dynamic: This characteristic defines whether the data's format, size, and memory location remain the same or change over time.
  3. Time complexity: By this characteristic, we can understand if any algorithm is operated on the data structure, then how much time will be required in any case? (Because the less time the system takes, the more perfect it will be identified)
  4. Correctness: By this characteristic, we can understand how precisely the data structure is implemented in the interface.
  5. Space complexity: This characteristic defines how carefully memory usage is maintained for a data structure.


Two Types of Data Structures

  1. Primitive Data Structures
  2. Non-primitive Data Structures
  1. Primitive Data Structure:- Primitive data structure is a data structure that can be operated directly from machine instructions. That is, it is defined by the system and the compiler.

Ex: integer, character, float, boolean (Basically data types)

  1. Non-primitive data structure:- A primitive data structure is a data structure that cannot be operated by direct machine instructions. These data structures are derived from primitive data structures.

Ex: Array, Linked list, stack, etc.

There are two types of non-primitive data structures:-

  1. Linear Data Structure
  2. Non-linear Structure
        1. Linear data structure

The linear data structure is a data structure in which data items are stored and arranged in a linear form, with one data item connected to another as a line.

Ex:- array, linked list, queue, stack.

Applications of linear data structures are mainly in application software development.

2. Non-linear data structure

The non-linear data structure is a data structure in which data items are not arranged sequentially. A data item can be associated with any number of other data items.

Ex:-tree, graph.

Applications of non-linear data structures are in Artificial Intelligence and image processing.


Classification Of Data Structure at a Glance


An array is a static data structure i.e. we can allocate memory only at compile time and cannot change it at run-time.

  1. One-dimensional (1-D) arrays:

Arrays that contain only one subscript are called one-dimensional arrays. It is used to store data in linear form.

  1. Two-dimensional (2-D) arrays:

The arrays in which there are two subscripts are called two-dimensional arrays. Two-dimensional arrays are also called matrices and tables.

  1. Multi-dimensional (M-D) arrays:

The arrays which contain more than two subscripts are called Muti-dimensional arrays.

57 a

Linked List

  • A linked list is a non-primitive, linear data structure.
  • A linked list is made up of a group of nodes. Each node has two parts, the first part is the data, and the second is the pointer. The linked list's pointer holds the next node's address. Nodes are used to store the data.
  • A linked list is a data structure whose length can be increased or decreased at runtime. That is, it is dynamic.

There are three types of linked lists:-

  1. Single linked list: It has a one-way direction, and each node of a single linked list has two fields:-
    1. The first is the field where the data store resides.
    2. The second is a pointer or link.
  2. Doubly linked list: It has a two-way direction. Each node of the doubly linked list consists of three parts:-
    1. In the first part, the data store is kept.
    2. The second part is the link to the next node.
    3. The third part is the link to the previous one.
  3. Circular linked list: Each node in the circular linked list is connected in the form of a circle.
    1. There is no NULL value at the end of the circular linked list.

In this, the last node is kept containing the address of the first node i.e. the first and last nodes are adjacent.

There are two types of circular linked lists:

1. Single circular linked list

2. Doubly circular linked list.    

57 b


The queue is a non-primitive and linear data structure, and it works on the principle of FIFO (first in, first out) i.e. the item which is added first will be removed first, and the item which is last. It is added to it; it will be removed at the end.

57 c

Following are the operations performed in Queue:-

Enqueue – When we add an item or element to the queue, then that operation is called enqueue.

Dequeue – When we delete an item from the queue, then that operation is called dequeue.

Peek – This operation is used to get the front element of the queue, and the element is not deleted in it.

isEmpty – This is used to check whether the queue is empty or not. When the queue is empty, it throws an underflow condition.

isFull – It is used to check whether the queue is completely full or not. When the queue is completely full then, it throws the overflow condition.

Different types of Queue:

It is four types, which are given below.

1. Linear Queue – Insertion is done from one end, and deletion is done from the other end. The end from where the insertion is done is called the rear end, and the end from where the deletion is done is called the front end.

2. Circular Queue – In this, all the nodes are presented as a circle. In this, the last element is associated with the first element. It is also called a ring buffer. In the Circular Queue, the item is added from the rear end and removed from the front end.

3. Priority Queue – This is a special type of queue in which each element has a priority associated with it, and it works on the basis of that priority. In this, the element which has the lowest priority is removed first. If the elements have the same priority, then the elements are arranged on the basis of the FIFO principle.

4. Dequeue – The full form of a Dequeue is a double-ended queue. Dequeue is a data structure in which we can add and remove items from both the front and rear ends.



Stack is a special type of linear data structure that works on the principle of LIFO (last in, first out) i.e. the item added last is removed first, and the item added first is added is removed at the end.

57 d

The following operations are performed in the stack:

push() – When the item is inserted in the stack, it is called a push operation, and if the stack is full, there is an overflow condition.

pop() – When an item is deleted from the stack, then this operation is called pop operation. If the stack is empty, then an underflow condition occurs.

We can say that the stack overflows when it is completely full, and we can say it underflows when it is completely empty.

isEmpty() – This operation tells whether the stack is empty or not.

isFull() – This operation tells whether the stack is full or not.

peek() – it returns the element at the given position,

count() – It returns the total number of elements present in the stack.

change() – It changes the element at the given position.

display() – It prints all the elements present in the stack.


The process of generating a fixed length value or key from a set of characters is called hashing. In this process of hashing, a mathematical function is used to generate the value or key.

Or in other words, "the hash value is created by applying a hashing algorithm to the message or data."

Hashing algorithms are also called ‘hash functions’.

We can easily understand hashing with the help of the example:-

Suppose Sidhu sends a message to Simran, then the hash value for this message is generated and encrypted, and this hash value is sent along with the message. When Simran receives this message, he decrypts this message as well as the hash.

After this, Simran generates another hash from the message; if both these hashes are the same, then only secure transmission will be possible.

57 e


We can easily understand the data structure graph on the basis of the following points:-

1. Graph is a non-primitive, non-linear data structure.

2. Graph is a group of vertices(node). One vertex is connected with another vertex, and the connection between two vertexes is called the edge. The edge acts as a communication link between two nodes.

3. Graph (V, E) is the group where V is the group of vertices and E is the group of edges.

57 f

Directed Graph:

A graph in which the edges have a direction is called a directed graph. And such edges are called directed edges. Directed edges are also called acres. Edges in a graph are represented by a line, and if each line carries an arrow mark, then it is called a directed graph. Directed graphs are also called diagrams.

Undirected Graph:

The graph does not have the direction of the edges; that is, there is no arrow mark in it. It is called an Undirected graph.

57 g

Weighted and Unweighted graphs:

Sometimes graphs have edges; they carry weight. These weights are real numbers. Both directed and undirected graphs can be weighted graphs. Graphs that do not carry weight are called unweighted graphs.

57 h


A tree is a hierarchical data structure that stores information or data in a hierarchical manner.

Structure of a Tree

  • A tree is a set of nodes that generally have a hierarchical relationship.
  • The tree is a non-linear data structure.
  • The tree has a parent-child relationship.
  • We call each data item in the tree a node.
  • The topmost node in the tree is called the root node.
  • A node can have at most one parent. But only the root node has no parent.
  • Each node in a tree can have zero or more child nodes.
  • Such nodes that do not have child nodes are called leaf nodes or terminal nodes.
  • Although the tree always grows upwards, the tree of the data structure always grows downwards.

57 i

In the data structure, there are the following types of Tree:

General Tree – A tree in which a node can have either zero child nodes or can have many child nodes. This type of tree is called a general tree.

In this, there is no restriction on child nodes. The topmost node of this tree is called the root node, and it can have many sub-trees.

Binary Tree – Binary means two numbers:- 0 and 1. A binary tree is a tree in which each node can have a maximum of two child nodes. In this, there is a restriction on child nodes because each node in a binary tree can have only two child nodes.

The topmost node in a binary tree is called the root node and has only two sub-trees: the right and left.

Binary Search Tree – Binary search tree is a non-linear data structure in which a node is associated with many nodes. It is a binary tree based on a node.

AVL tree – This is a type of binary tree. It is also called a self-balancing binary search tree. It has extra information, which is called the balance factor.

B-tree – A B-tree is an M-Way (multi-way) tree specially designed for use in disks. A ‘B-tree’ is called a balanced tree.

Applications of Data Structures

Data structures are used in various fields, such as

  • Operating systems
  • Graphics
  • Computer Design
  • Blockchain
  • Genetics
  • Image Processing
  • Simulation


Data is the fuel that drives today's commerce engines, and data scientists are in high demand. Since 2012, the demand for data scientists has increased by 650%, and this trend is expected to continue. The data scientist profession is still one of the hottest IT careers today, and you can now get in on the action.

OdinSchool offers an intensive hands-on Data Science Course with placement assistance. It is led by industry experts and provides an industry-vetted curriculum with a particular emphasis on the most in-demand skills.

Connect with a career counsellor to launch your career to new heights!


Data science bootcamp

About the Author

Pratham is a Data Science Subject Matter Expert. Read all of his detailed blogs here.

Join OdinSchool's Data Science Bootcamp

With Job Assistance

View Course