A data structure is a particular way of organising data in a computer so that it can be used
effectively. The idea is to reduce the space and time complexities of different tasks.
The choice of a good data structure makes it possible to perform a variety of critical operations
effectively. An efficient data structure also uses minimum memory space and execution time to
process the structure. A data structure is not only used for organising the data. It is also used for
processing, retrieving, and storing data.
Need Of Data Structure:
The structure of the data and the synthesis of the algorithm are relative to each other. Data
presentation must be easy to understand so the developer, as well as the user, can make an efficient
implementation of the operation.
Data structures provide an easy way of organising, retrieving, managing, and storing data.
Here is a list of the needs for data.
• Data structure modification is easy.
• It requires less time.
• Save storage memory space.
• Data representation is easy.
• Easy access to the large database
Classification/Types of Data Structures:
1. Linear Data Structure
2. Non-Linear Data Structure.
Linear Data Structure:
• Elements are arranged in one dimension ,also known as linear dimension.
• Example: lists, stack, queue, etc.
Non-Linear Data Structure
• Elements are arranged in one-many, many-one and many-many dimensions.
• Example: tree, graph, table, etc.
Data type Vs. Data structure
A data type is the most basic and the most common classification of data. It is this through which the
compiler gets to know the form or the type of information that will be used throughout the code. So
basically data type is a type of information transmitted between the programmer and the compiler
where the programmer informs the compiler about what type of data is to be stored and also tells
how much space it requires in the memory. Some basic examples are int, string etc.
A data structure is a collection of different forms and different types of data that has a set of specific
operations that can be performed. It is a collection of data types. It is a way of organizing the items in
terms of memory, and also the way of accessing each item through some defined logic. Some
examples of data structures are stacks, queues, linked lists, binary tree and many more. Data
structures perform some special operations only like insertion, deletion and traversal. For example,
you have to store data for many employees where each employee has his name, employee id and a
mobile number. So this kind of data requires complex data management, which means it requires
data structure comprised of multiple primitive data types. So data structures are one of the most
important aspects when implementing coding concepts in real-world applications.
Data Types Data Structures
Data Type is the kind or form of a variable Data Structure is the collection of different
which is being used throughout the program. It kinds of data. That entire data can be
defines that the particular variable will assign represented using an object and can be used
the values of the given data type only throughout the entire program.
Implementation through Data Types is a form Implementation through Data Structures is
of abstract implementation called concrete implementation
Data Types Data Structures
Can hold different kind and types of data
Can hold values and not data, so it is data less
within one single object
The data is assigned to the data structure
Values can directly be assigned to the data
object using some set of algorithms and
type variables
operations like push, pop and so on.
Time complexity comes into play when
No problem of time complexity
working with data structures
Examples: int, float, double Examples: stacks, queues, tree
An Abstract Data Type (ADT) is a conceptual model that defines a set of operations and behaviors for
a data structure, without specifying how these operations are implemented or how data is organized
in memory. The definition of ADT only mentions what operations are to be performed but
not how these operations will be implemented. It does not specify how data will be organized in
memory and what algorithms will be used for implementing the operations. It is called "abstract"
because it provides an implementation-independent view.
The abstract datatype is special kind of datatype, whose behavior is defined by a set of values and set
of operations. The keyword “Abstract” is used as we can use these datatypes, we can perform
different operations. But how those operations are working that is totally hidden from the user. The
ADT is made of with primitive datatypes, but operation logics are hidden.
Some examples of ADT are Stack, Queue, List etc.
Data Structure Types, Classifications and Applications
A data structure is a storage that is used to store and organize data. It is a way of arranging data on a
computer so that it can be accessed and updated efficiently.
A data structure organizes, processes, retrieves, and stores data, making it essential for nearly every
program or software system. To help you master them, we've compiled a comprehensive guide
covering types, classifications, and applications of data structures. This article simplifies everything,
helping you choose the right one in minutes.
Classification of Data Structure
Data structure has many different uses in our daily life. There are many different data structures that
are used to solve different mathematical and logical problems. By using data structure, one can
organize and process a very large amount of data in a relatively short period. Let's look at different
data structures that are used in different situations.
Classification of Data Structure
• Linear data structure: Data structure in which data elements are arranged sequentially or
linearly, where each element is attached to its previous and next adjacent elements, is called
a linear data structure.
Examples: array, stack, queue, linked list, etc.
o Static data structure: Static data structure has a fixed memory size. It is easier to
access the elements in a static data structure.
Example: array data structure.
o Dynamic data structure: In the dynamic data structure, the size is not fixed. It can be
randomly updated during the runtime which may be considered efficient concerning
the memory (space) complexity of the code.
Examples: stack and queue data structures.
• Non-linear data structure: Data structures where data elements are not placed sequentially
or linearly are called non-linear data structures. In a non-linear data structure, we can't
traverse all the elements in a single run.
Examples: tree and graph data structures.
Arrays Data Structure
An array is a linear data structure and it is a collection of element of same data type stored
at contiguous memory locations.
It offers mainly the following advantages.
• Random Access: i-th elements can be accessed in O(1) Time as we have the base address
and every element is of same size.
• Cache Friendliness: Since elements are stored at contiguous locations, we get the advantage
of locality of reference.
Array
Different applications of an array are as follows:
Arrays efficiently manage and store database records.
• It helps in implementing sorting algorithm.
• It is also used to implement other data structures like Stacks, Queues, Heaps, Hash tables,
etc.
• An array can be used for CPU scheduling.
Linked list Data Structure
A linked list is a linear data structure in which elements are not stored at contiguous memory
locations. The elements in a linked list are linked using pointers as shown in the below image.
Linked List
Applications of the Linked list
• Linked lists are used to implement other data structures like stacks, queues, etc.
• It is used for the representation of sparse matrices.
• It is used in the linked allocation of files.
• Linked lists are used to display image containers. Users can visit past, current, and next
images.
• They are used to perform undo operations.
Want to get started with a linked list? You can try out our curated articles and lists for the best
practice:
Stack Data Structure
Stack is a linear data structure that follows LIFO(Last in first out) principle i.e., entering and retrieving
data is possible from only one end. The entering and retrieving of data is also called push and pop
operation in a stack.
Stack
Applications of Stack
Different applications of Stack are as follows:
• The stack data structure is used in the evaluation and conversion of arithmetic expressions.
• It is used for parenthesis checking and string reversal.
• A memory stack is also used for processing function calls.
• The stack is used in virtual machines like JVM.
Queue Data Structure
Queue is a linear data structure that follows First In First Out(FIFO) principle i.e. the data item stored
first will be accessed first. In this, entering is done from one end and retrieving data is done from
other end. An example of a queue is any queue of consumers for a resource where the consumer
that came first is served first.
Queue
Applications of Queue:
Different applications of Queue are as follows:
• Queue is used for handling website traffic.
• It helps to maintain the playlist in media players.
• It helps in serving requests on a single shared resource, like a printer, CPU task scheduling,
etc.
• Queues are used for job scheduling in the operating system.
Tree Data Structure
A tree is a non-linear and hierarchical data structure where the elements are arranged in a tree-like
structure. In a tree, the topmost node is called the root node. Each node contains some data, and
data can be of any type. It consists of a central node, structural nodes, and sub-nodes which are
connected via edges. Different tree data structures allow quicker and easier access to the data as it is
a non-linear data structure.
Tree
Applications of Tree:
• Heap is a tree data structure that is implemented using arrays and used to implement
priority queues.
• B-Tree and B+ Tree are used to implement indexing in databases.
• Syntax Tree helps in scanning, parsing, generation of code, and evaluation of arithmetic
expressions in Compiler design.
• Spanning trees are used in routers in computer networks.
• Domain Name Server also uses a tree data structure.
Binary Search Tree Data Structure
A Binary Search Tree (or BST) is a data structure used for organizing and storing data in a sorted
manner. Each node in a Binary Search Tree has at most two children, a left child and a right child,
with the left child containing values less than the parent node and the right child containing values
greater than the parent node. This hierarchical structure allows for efficient searching, insertion,
and deletion operations on the data stored in the tree.
Applications of Binary Search Tree:
• A Self-Balancing BST maintains a sorted stream of data in RAM, useful for tracking online
orders by price and querying item counts above or below a given cost.
• It enables a doubly-ended priority queue, supporting
both extractMin() and extractMax() in O(log n) time, unlike a Binary Heap.
• Many algorithmic problems, like counting smaller elements on the right or finding the
smallest greater element, benefit from a Self-Balancing BST.
• TreeMap and TreeSet in Java, and set and map in C++, are implemented using Red-Black
Trees, a type of Self-Balancing BST.
Graph Data Structure
A graph is a non-linear data structure that consists of vertices (or nodes) and edges. It consists of a
finite set of vertices and set of edges that connect a pair of nodes. The graph is used to solve the
most challenging and complex programming problems. It has different terminologies which are Path,
Degree, Adjacent vertices, Connected components, etc.
Graph
Applications of Graph:
• The operating system uses Resource Allocation Graph.
• Also used in the World Wide Web where the web pages represent the nodes.
• One of the most common real-world examples of a graph is Google Maps where cities are
located as vertices and paths connecting those vertices are located as edges of the graph.
• A social network is also one real-world example of a graph where every person on the
network is a node, and all of their friendships on the network are the edges of the graph.