Types of Linked List

 The following are the types of linked list:

Singly Linked list
 
Single linked list is a sequence of elements in which every element has link to its next element in the sequence.

In any single linked list, the individual element is called as "Node". Every "Node" contains two fields, data field, and the next field. The data field is used to store actual value of the node and next field is used to store the address of next node in the sequence.
The graphical representation of a node in a single linked list is as follows...

Example
 
Doubly linked list
 
Double linked list is a sequence of elements in which every element has links to its previous element and next element in the sequence.
In a double linked list, every node has a link to its previous node and next node. So, we can traverse forward by using the next field and can traverse backward by using the previous field. Every node in a double linked list contains three fields.
 

Example
 

 
 
 
Circular linked list
 
A circular linked list is a sequence of elements in which every element has a link to its next element in the sequence and the last element has a link to the first element.
 

That means circular linked list is similar to the single linked list except that the last node points to the first node in the list

Example
 

 
 
 

 

No comments:

Post a Comment