Data Structure in Java is defined as the collection of data pieces that offer an effective means of storing and organizing data in a computer. Linked List, Stack, Queue, and arrays are a few examples of Java data structures.
There are two types of Data Structures:-
- Primitive Data Structures
- Non-primitive 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 are of two types:-
- Linear Data Structures
- Non-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
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