What is data structure
A data structure is a way of organizing the data that includes both storage of data items ,defines a mechanism to retrieve data and their relationship with each other i.e file, stack,array and anything that stores data items, defines how to access data and maintains their relationship.
It is very important to know about relationship between data items of data structure as it helps in designing of efficient algorithms for the manipulation of data.
Types of data structure
Basically there are two types of data structure ,
- Linear data structure
- Non linear data structure
Linear data structure
Data structures in which position of inserted item depends on the items that came before and came after it are referred as linear data structure.In linear data structure , traversing operation takes place sequentially ,we can reach only one element directly from another.
Linear data structure can be thought of having two end. Sometimes these ends are referred to as the “left” and the “right” or in some cases the “front” and the “rear” or in some cases the “top” and the “bottom”.
Examples of Linear data structure
- Stack
- Queue
- Deque
- list
NON Linear data structure
A data structure is said to be non linear if its element do not form a sequence or a linear series but form a hierarchical order.
Examples of Non Linear data structure
- Tree
- Graph