Published on : 29th Sep 2021

Basic Data Structures
Data structure is used to store and manipulate data efficiently. There are two types of data structure.
- Linear
- Non-linear
In linear data structure, data is stored sequentially.
In non-linear data structure, data is stored hierarchically.
Linear data structures:
Array: Array is a collection of similar types elements. The elements are stored in contiguous memory locations.
Linked list: Linked list is also a collection of similar types of elements. The elements are stored in non-contiguous memory locations unlike array.
Stack: Stack is a Last-In First-Out (LIFO) data structure. The top most element is pushed on the stack and top most element is popped from the
stack.
Queue: Queue is a First-In First-Out(FIFO) data structure. We insert element in rear and remove element from front.
Non-linear data structures:
Tree: A tree is a abstract data type that simulates hierarchical tree structure. A tree is a simple, undirected and acyclic graph. A tree is a set of vertices and
a set of edges. It is represented as T = (V, E)
Graph: A graph is an abstract data type(ADT) that is used to represent complex relationship among objects. A graph is a set of vertices and a set of objects.