What Are Data Structures - Definition and Types - Javatpoint
What Are Data Structures - Definition and Types - Javatpoint
Home Python Java JavaScript HTML SQL PHP C#
DS Tutorial
DS Tutorial
DS Introduction
DS Algorithm
Asymptotic Analysis
DS Pointer
DS Structure
DS Array
DS Array
2D Array
DS Linked List
Linked List
https://www.javatpoint.com/data-structure-introduction 1/27
1/20/25, 8:53 PM What are Data Structures? Definition and Types - javatpoint
Skip list in DS
DS Stack
DS Stack
Array Implementation
← prev next →
Data is a collection of facts and figures or a set of values or values of a specific format that
refers to a single set of item values. The data items are then classified into sub-items, which
is the group of items that are not known as the simple primary form of the item.
Let us consider an example where an employee name can be broken down into three sub-
items: First, Middle, and Last. However, an ID assigned to an employee will generally be
considered a single item.
https://www.javatpoint.com/data-structure-introduction 2/27
1/20/25, 8:53 PM What are Data Structures? Definition and Types - javatpoint
In the example mentioned above, the items such as ID, Age, Gender, First, Middle, Last,
Street, Locality, etc., are elementary data items. In contrast, the Name and the Address are
group data items.
1. First, it must be loaded enough into the structure to reflect the definite correlation of the data
with a real-world object.
2. Second, the formation should be so straightforward that one can adapt to process the data
efficiently whenever necessary.
Some examples of Data Structures are Arrays, Linked Lists, Stack, Queue, Trees, etc. Data
Structures are widely used in almost every aspect of Computer Science, i.e., Compiler
Design, Operating Systems, Graphics, Artificial Intelligence, and many more.
Data Structures are the main part of many Computer Science Algorithms as they allow the
programmers to manage the data in an effective way. It plays a crucial role in improving the
performance of a program or software, as the main objective of the software is to store and
retrieve the user's data as fast as possible.
The following are some fundamental terminologies used whenever the data structures are
involved:
1. Data: We can define data as an elementary value or a collection of values. For example, the
Employee's name and ID are the data related to the Employee.
2. Data Items: A Single unit of value is known as Data Item.
https://www.javatpoint.com/data-structure-introduction 3/27
1/20/25, 8:53 PM What are Data Structures? Definition and Types - javatpoint
3. Group Items: Data Items that have subordinate data items are known as Group Items. For
example, an employee's name can have a first, middle, and last name.
4. Elementary Items: Data Items that are unable to divide into sub-items are known as
Elementary Items. For example, the ID of an Employee.
5. Entity and Attribute: A class of certain objects is represented by an Entity. It consists of
different Attributes. Each Attribute symbolizes the specific property of that Entity. For
example,
Entities with similar attributes form an Entity Set. Each attribute of an entity set has a range
of values, the set of all possible values that could be assigned to the specific attribute.
The term "information" is sometimes utilized for data with given attributes of meaningful or
processed data.
1. Field: A single elementary unit of information symbolizing the Attribute of an Entity is known
as Field.
2. Record: A collection of different data items are known as a Record. For example, if we talk
about the employee entity, then its name, id, address, and job title can be grouped to form
the record for the employee.
3. File: A collection of different Records of one entity type is known as a File. For example, if
there are 100 employees, there will be 25 records in the related file containing data about
each employee.
https://www.javatpoint.com/data-structure-introduction 4/27
1/20/25, 8:53 PM What are Data Structures? Definition and Types - javatpoint
2. Data Structures allow us to organize and store data, whereas Algorithms allow us to process
that data meaningfully.
3. Learning Data Structures and Algorithms will help us become better Programmers.
4. We will be able to write code that is more effective and reliable.
5. We will also be able to solve problems more quickly and efficiently.
1. Correctness: Data Structures are designed to operate correctly for all kinds of inputs based
on the domain of interest. In order words, correctness forms the primary objective of Data
Structure, which always depends upon the problems that the Data Structure is meant to
solve.
2. Efficiency: Data Structures also requires to be efficient. It should process the data quickly
without utilizing many computer resources like memory space. In a real-time state, the
efficiency of a data structure is a key factor in determining the success and failure of the
process.
1. Robustness: Generally, all computer programmers aim to produce software that yields
correct output for every possible input, along with efficient execution on all hardware
platforms. This type of robust software must manage both valid and invalid inputs.
2. Adaptability: Building software applications like Web Browsers, Word Processors, and
Internet Search Engine include huge software systems that require correct and efficient
working or execution for many years. Moreover, software evolves due to emerging
technologies or ever-changing market conditions.
3. Reusability: The features like Reusability and Adaptability go hand in hand. It is known that
the programmer needs many resources to build any software, making it a costly enterprise.
However, if the software is developed in a reusable and adaptable way, then it can be applied
in most future applications. Thus, by executing quality data structures, it is possible to build
reusable software, which appears to be cost-effective and timesaving.
3. The focus of these data structures is on forming a set of data elements that is either
homogeneous (same data type) or heterogeneous (different data types).
4. Based on the structure and arrangement of data, we can divide these data structures into
two sub-categories -
1. Linear Data Structures
2. Non-Linear Data Structures
Based on memory allocation, the Linear Data Structures are further classified into two
types:
1. Static Data Structures: The data structures having a fixed size are known as Static Data
Structures. The memory for these data structures is allocated at the compiler time, and their
size cannot be changed by the user after being compiled; however, the data stored in them
can be altered.
The Array is the best example of the Static Data Structure as they have a fixed size, and its
data can be modified later.
2. Dynamic Data Structures: The data structures having a dynamic size are known as Dynamic
Data Structures. The memory of these data structures is allocated at the run time, and their
size varies during the run time of the code. Moreover, the user can change the size as well as
the data elements stored in these data structures at the run time of the code.
Linked Lists, Stacks, and Queues are common examples of dynamic data structures
1. Arrays
An Array is a data structure used to collect multiple data elements of the same data type
into one variable. Instead of storing multiple values of the same data types in separate
variable names, we could store all of them together into one variable. This statement
doesn't imply that we will have to unite all the values of the same data type in any program
https://www.javatpoint.com/data-structure-introduction 7/27
1/20/25, 8:53 PM What are Data Structures? Definition and Types - javatpoint
into one array of that data type. But there will often be times when some specific variables
of the same data types are all related to one another in a way appropriate for an array.
An Array is a list of elements where each element has a unique place in the list. The data
elements of the array share the same variable name; however, each carries a different index
number called a subscript. We can access any data element from the list with the help of its
location in the list. Thus, the key feature of the arrays to understand is that the data is stored
in contiguous memory locations, making it possible for the users to traverse through the
data elements of the array using their respective indexes.
Figure 3. An Array
1. One-Dimensional Array: An Array with only one row of data elements is known as
a One-Dimensional Array. It is stored in ascending storage location.
2. Two-Dimensional Array: An Array consisting of multiple rows and columns of
data elements is called a Two-Dimensional Array. It is also known as a Matrix.
3. Multidimensional Array: We can define Multidimensional Array as an Array of
Arrays. Multidimensional Arrays are not bounded to two indices or two
dimensions as they can include as many indices are per the need.
1. We can store a list of data elements belonging to the same data type.
2. Array acts as an auxiliary storage for other data structures.
3. The array also helps store data elements of a binary tree of the fixed count.
4. Array also acts as a storage of matrices.
2. Linked Lists
A Linked List is another example of a linear data structure used to store a collection of data
elements dynamically. Data elements in this data structure are represented by the Nodes,
connected using links or pointers. Each node contains two fields, the information field
consists of the actual data, and the pointer field consists of the address of the subsequent
https://www.javatpoint.com/data-structure-introduction 8/27
1/20/25, 8:53 PM What are Data Structures? Definition and Types - javatpoint
nodes in the list. The pointer of the last node of the linked list consists of a null pointer, as it
points to nothing. Unlike the Arrays, the user can dynamically adjust the size of a Linked List
as per the requirements.
1. Singly Linked List: A Singly Linked List is the most common type of Linked List.
Each node has data and a pointer field containing an address to the next node.
2. Doubly Linked List: A Doubly Linked List consists of an information field and two
pointer fields. The information field contains the data. The first pointer field
contains an address of the previous node, whereas another pointer field contains
a reference to the next node. Thus, we can go in both directions (backward as well
as forward).
3. Circular Linked List: The Circular Linked List is similar to the Singly Linked List.
The only key difference is that the last node contains the address of the first node,
forming a circular loop in the Circular Linked List.
1. The Linked Lists help us implement stacks, queues, binary trees, and graphs of
predefined size.
2. We can also implement Operating System's function for dynamic memory
management.
3. Linked Lists also allow polynomial implementation for mathematical operations.
4. We can use Circular Linked List to implement Operating Systems or application
functions that Round Robin execution of tasks.
5. Circular Linked List is also helpful in a Slide Show where a user requires to go back
to the first slide after the last slide is presented.
6. Doubly Linked List is utilized to implement forward and backward buttons in a
browser to move forward and backward in the opened pages of a website.
3. Stacks
https://www.javatpoint.com/data-structure-introduction 9/27
1/20/25, 8:53 PM What are Data Structures? Definition and Types - javatpoint
A Stack is a Linear Data Structure that follows the LIFO (Last In, First Out) principle that
allows operations like insertion and deletion from one end of the Stack, i.e., Top. Stacks can
be implemented with the help of contiguous memory, an Array, and non-contiguous
memory, a Linked List. Real-life examples of Stacks are piles of books, a deck of cards, piles
of money, and many more.
The above figure represents the real-life example of a Stack where the operations are
performed from one end only, like the insertion and removal of new books from the top of
the Stack. It implies that the insertion and deletion in the Stack can be done only from the
top of the Stack. We can access only the Stack's tops at any given time.
https://www.javatpoint.com/data-structure-introduction 10/27
1/20/25, 8:53 PM What are Data Structures? Definition and Types - javatpoint
Figure 6. A Stack
4. Queues
A Queue is a linear data structure similar to a Stack with some limitations on the insertion
and deletion of the elements. The insertion of an element in a Queue is done at one end,
https://www.javatpoint.com/data-structure-introduction 11/27
1/20/25, 8:53 PM What are Data Structures? Definition and Types - javatpoint
and the removal is done at another or opposite end. Thus, we can conclude that the Queue
data structure follows FIFO (First In, First Out) principle to manipulate the data elements.
Implementation of Queues can be done using Arrays, Linked Lists, or Stacks. Some real-life
examples of Queues are a line at the ticket counter, an escalator, a car wash, and many
more.
The above image is a real-life illustration of a movie ticket counter that can help us
understand the Queue where the customer who comes first is always served first. The
customer arriving last will undoubtedly be served last. Both ends of the Queue are open
and can execute different operations. Another example is a food court line where the
customer is inserted from the rear end while the customer is removed at the front end after
providing the service they asked for.
1. Enqueue: The insertion or Addition of some data elements to the Queue is called
Enqueue. The element insertion is always done with the help of the rear pointer.
2. Dequeue: Deleting or removing data elements from the Queue is termed
Dequeue. The deletion of the element is always done with the help of the front
pointer.
https://www.javatpoint.com/data-structure-introduction 12/27
1/20/25, 8:53 PM What are Data Structures? Definition and Types - javatpoint
Figure 8. A Queue
1. Trees
A Tree is a Non-Linear Data Structure and a hierarchy containing a collection of nodes such
that each node of the tree stores a value and a list of references to other nodes (the
"children").
The Tree data structure is a specialized method to arrange and collect data in the computer
to be utilized more effectively. It contains a central node, structural nodes, and sub-nodes
https://www.javatpoint.com/data-structure-introduction 13/27
1/20/25, 8:53 PM What are Data Structures? Definition and Types - javatpoint
connected via edges. We can also say that the tree data structure consists of roots,
branches, and leaves connected.
Figure 9. A Tree
1. Binary Tree: A Tree data structure where each parent node can have at most two
children is termed a Binary Tree.
2. Binary Search Tree: A Binary Search Tree is a Tree data structure where we can
easily maintain a sorted list of numbers.
3. AVL Tree: An AVL Tree is a self-balancing Binary Search Tree where each node
maintains extra information known as a Balance Factor whose value is either -1, 0,
or +1.
4. B-Tree: A B-Tree is a special type of self-balancing Binary Search Tree where each
node consists of multiple keys and can have more than two children.
2. Graphs
G = (V,E)
https://www.javatpoint.com/data-structure-introduction 15/27
1/20/25, 8:53 PM What are Data Structures? Definition and Types - javatpoint
The above figure represents a Graph having seven vertices A, B, C, D, E, F, G, and ten edges
[A, B], [A, C], [B, C], [B, D], [B, E], [C, D], [D, E], [D, F], [E, F], and [E, G].
Depending upon the position of the vertices and edges, the Graphs can be classified
into different types:
1. Null Graph: A Graph with an empty set of edges is termed a Null Graph.
2. Trivial Graph: A Graph having only one vertex is termed a Trivial Graph.
3. Simple Graph: A Graph with neither self-loops nor multiple edges is known as a
Simple Graph.
4. Multi Graph: A Graph is said to be Multi if it consists of multiple edges but no self-
loops.
5. Pseudo Graph: A Graph with self-loops and multiple edges is termed a Pseudo
Graph.
6. Non-Directed Graph: A Graph consisting of non-directed edges is known as a
Non-Directed Graph.
7. Directed Graph: A Graph consisting of the directed edges between the vertices is
known as a Directed Graph.
8. Connected Graph: A Graph with at least a single path between every pair of
vertices is termed a Connected Graph.
https://www.javatpoint.com/data-structure-introduction 16/27
1/20/25, 8:53 PM What are Data Structures? Definition and Types - javatpoint
9. Disconnected Graph: A Graph where there does not exist any path between at
least one pair of vertices is termed a Disconnected Graph.
10. Regular Graph: A Graph where all vertices have the same degree is termed a
Regular Graph.
11. Complete Graph: A Graph in which all vertices have an edge between every pair
of vertices is known as a Complete Graph.
12. Cycle Graph: A Graph is said to be a Cycle if it has at least three vertices and
edges that form a cycle.
13. Cyclic Graph: A Graph is said to be Cyclic if and only if at least one cycle exists.
14. Acyclic Graph: A Graph having zero cycles is termed an Acyclic Graph.
15. Finite Graph: A Graph with a finite number of vertices and edges is known as a
Finite Graph.
16. Infinite Graph: A Graph with an infinite number of vertices and edges is known as
an Infinite Graph.
17. Bipartite Graph: A Graph where the vertices can be divided into independent sets
A and B, and all the vertices of set A should only be connected to the vertices
present in set B with some edges is termed a Bipartite Graph.
18. Planar Graph: A Graph is said to be a Planar if we can draw it in a single plane
with two edges intersecting each other.
19. Euler Graph: A Graph is said to be Euler if and only if all the vertices are even
degrees.
20. Hamiltonian Graph: A Connected Graph consisting of a Hamiltonian circuit is
known as a Hamiltonian Graph.
https://www.javatpoint.com/data-structure-introduction 17/27
1/20/25, 8:53 PM What are Data Structures? Definition and Types - javatpoint
8. Graphs are also used to make document link maps of the websites in order to
display the connectivity between the pages through hyperlinks.
9. Graphs are also used in robotic motions and neural networks.
1. Traversal: Traversing a data structure means accessing each data element exactly once so it
can be administered. For example, traversing is required while printing the names of all the
employees in a department.
2. Search: Search is another data structure operation which means to find the location of one or
more data elements that meet certain constraints. Such a data element may or may not be
present in the given set of data elements. For example, we can use the search operation to
find the names of all the employees who have the experience of more than 5 years.
3. Insertion: Insertion means inserting or adding new data elements to the collection. For
example, we can use the insertion operation to add the details of a new employee the
company has recently hired.
4. Deletion: Deletion means to remove or delete a specific data element from the given list of
data elements. For example, we can use the deleting operation to delete the name of an
employee who has left the job.
5. Sorting: Sorting means to arrange the data elements in either Ascending or Descending
order depending on the type of application. For example, we can use the sorting operation to
arrange the names of employees in a department in alphabetical order or estimate the top
three performers of the month by arranging the performance of the employees in
descending order and extracting the details of the top three.
6. Merge: Merge means to combine data elements of two sorted lists in order to form a single
list of sorted data elements.
7. Create: Create is an operation used to reserve memory for the data elements of the program.
We can perform this operation using a declaration statement. The creation of data structure
can take place either during the following:
1. Compile-time
2. Run-time
For example, the malloc() function is used in C Language to create data structure.
8. Selection: Selection means selecting a particular data from the available data. We can select
any particular data by specifying conditions inside the loop.
https://www.javatpoint.com/data-structure-introduction 18/27
1/20/25, 8:53 PM What are Data Structures? Definition and Types - javatpoint
9. Update: The Update operation allows us to update or modify the data in the data structure.
We can also update any particular data by specifying some conditions inside the loop, like the
Selection operation.
10. Splitting: The Splitting operation allows us to divide data into various subparts decreasing the
overall process completion time.
From the definition mentioned above, we can conclude that the operations in data
structure include:
Whenever the data structure does such operations, it is known as an Abstract Data Type
(ADT).
We can define it as a set of data elements along with the operations on the data. The term
"abstract" refers to the fact that the data and the fundamental operations defined on it are
being studied independently of their implementation. It includes what we can do with the
data, not how we can do it.
An ADI implementation contains a storage structure in order to store the data elements
and algorithms for fundamental operation. All the data structures, like an array, linked list,
queue, stack, etc., are examples of ADT.
https://www.javatpoint.com/data-structure-introduction 19/27
1/20/25, 8:53 PM What are Data Structures? Definition and Types - javatpoint
separate a data structure from its implementation information. This is the principle behind
the usage of Abstract Data Types (ADT).
Apart from those, as mentioned earlier, there are many other applications of Data
Structures that can help us build any desired software.
← prev next →
Related Posts
https://www.javatpoint.com/data-structure-introduction 20/27
1/20/25, 8:53 PM What are Data Structures? Definition and Types - javatpoint
DS Pointer
Pointer Pointer is used to points the address of the value stored anywhere in the computer
memory. To obtain the value stored at the location is known as dereferencing the pointer.
Pointer improves the performance for repetitive process such as: Traversing String Lookup
Tables Control Tables Tree Structures Pointer Details Pointer arithmetic:...
8 min read
DS Algorithm
What is an Algorithm? An algorithm is a process or a set of rules required to perform
calculations or some other problem-solving operations especially by a computer. The
formal definition of an algorithm is that it contains the finite set of instructions which are
being carried in...
9 min read
DS Tutorial
Data Structures Tutorial Data Structures (DS) tutorial provides basic and advanced
concepts of Data Structure. Our Data Structure tutorial is designed for beginners and
professionals. Data Structure is a way to store and organize data so that it can be used
efficiently. Our Data Structure tutorial includes all topics of...
7 min read
Asymptotic Analysis
As we know that data structure is a way of organizing the data efficiently and that
efficiency is measured either in terms of time or space. So, the ideal data structure is a
structure that occupies the least possible time to perform all its operation and...
9 min read
DS Structure
https://www.javatpoint.com/data-structure-introduction 21/27
1/20/25, 8:53 PM What are Data Structures? Definition and Types - javatpoint
Structure A structure is a composite data type that defines a grouped list of variables that
are to be placed under one name in a block of memory. It allows different variables to be
accessed by using a single pointer to the structure. Syntax struct structure_name { ...
1 min read
Python Java
Javascript HTML
Database PHP
C++ React
https://www.javatpoint.com/data-structure-introduction 22/27
1/20/25, 8:53 PM What are Data Structures? Definition and Types - javatpoint
B.Tech / MCA
Data
DBMS
Structures
Operating
DAA
System
Computer Compiler
Network Design
Computer Discrete
Organization Mathematics
Ethical Computer
Hacking Graphics
https://www.javatpoint.com/data-structure-introduction 23/27
1/20/25, 8:53 PM What are Data Structures? Definition and Types - javatpoint
Web Software
Technology Engineering
Cyber
Automata
Security
C
C++
Programming
Java .Net
Python Programs
https://www.javatpoint.com/data-structure-introduction 24/27
1/20/25, 8:53 PM What are Data Structures? Definition and Types - javatpoint
Control Data
System Warehouse
Preparation
Aptitude Reasoning
Verbal Interview
Ability Questions
Company
Questions
https://www.javatpoint.com/data-structure-introduction 25/27
1/20/25, 8:53 PM What are Data Structures? Definition and Types - javatpoint
https://www.javatpoint.com/data-structure-introduction 26/27
1/20/25, 8:53 PM What are Data Structures? Definition and Types - javatpoint
https://www.javatpoint.com/data-structure-introduction 27/27