Linear data structure:
A data structure is said to be linear if its data item form a linear sequence.
Examples of the linear data structure are:
(a) Array (b) Linked List (c) Stack (d) Queue
An array is a collection of data elements of same datatype.
The elements of the array are stored in consecutive memory locations.
Arrays are declared using the following syntax: type name[size];
A stack is a linear list in which insertion and deletion operations are performed at only one end of the list.
- It follows LIFO structure.
A queue is a linear list in which insertion is performed at one end, called rear and deletion is performed at another end of the list, called front.
- It follows FIFO structure
A linked list is a collection of nodes. Each node has two fields: (i) Information (ii) address, which contains the address of the next node.
Non Linear data structure:
A data structure is said to be non linear if its data items does not form a linear sequence.
Examples of the non linear data structure are:
(a) Tree (b) Graph
Tree is a collection of nodes (V) and edges (E) that follows hierarchical relationship.