Data Structures
What are Data Structures?
• A data structure is defined as a format for arranging,
processing, accessing, and storing data. Data
structures are the combination of both simple and
complex forms, all of which are made to organize data
for a certain use. Users find it simple to access the
data they need and use it appropriately thanks to data
structures.
If you want to store data in
One on the other - Stacks
Linear fashion - Array/ Linked List
Hierarchical Fashion - Trees
Connect Nodes - Graph
What are Data Structures in Java?
Data Structure in java is defined as the collection of
data pieces that offers an effective means of storing
and organizing data in a computer.
Types of Data Structures in Java
• Array
• Linked List
• Stack
• Queue
• Binary Tree
• Binary Search Tree
• Heap
• Hashing
• Graph
Pictorial representation of types of java data
structures
Further classification of types of Data Structures
• Primitive data Structures are also called Primitive Data Types. byte,
short, int, float, char, boolean, long, and double are primitive Data
types.
• Non-primitive data Structures – Non-primitive Data Structures are of
two types:-
• Linear Data Structures
• Non-linear Data Structures
• Linear Data Structures – The elements arranged in a linear fashion
are called Linear Data Structures. Here, each element is connected to
one other element only. Linear Data Structures are as follows:
• Arrays
• Single dimensional Array
• Multidimensional Array
• Stack
• Queue
• Linked List
• Singly-linked list
• Doubly Linked list
• Circular Linked List
• Non-Linear Data Structures – The elements arranged in a non-linear
fashion are called Non-Linear Data Structures. Here, each element is
connected to n-other elements. Non-Linear Data Structures are as follows:
• Trees
• Binary Tree
• Binary Search Tree
• AVL Tree
• Red-Black Tree
• Graph
• Heap
• MaxHeap
• MinHeap
• Hash
• HashSet
• HashMap
Advantages of Data Structures in java
• Efficiency
• Reusability
• Processing Speed
• Abstraction- a process of hiding the implementation details and
showing only functionality to the user. Another way, it shows only
essential things to the user and hides the internal details
• Data Searching
Classification of Data Structures
• Static Data Structures are the Data structures whose size is declared
and fixed at Compile Time and cannot be changed later are called
Static Data structures.
• Example – Arrays
• Dynamic Data Structures are the Data Structures whose size is not
fixed at compile time and can be decided at runtime depending upon
requirements are called Dynamic Data structures.
• Example – Binary Search Tree