Click here to hide categories Click here to show left categories

User: Home          welcome : Guest          Log In / Register here     




Explain different types of linked lists.

1. Linear Linked List or One Way List or Singly Linked List:-

It is linear collection of data elements which are called ‘Nodes’. The elements may or may not be stored in consecutive memory locations. So pointers are used maintain linear order. Each node is divided into two parts. The first part contains the information of the element and is called ‘INFO Field’. The second part contains the address of the next node and is called ‘LINK Field’ or ‘NEXT Pointer Field’. The START contains the starting address of the linked list i.e. it contains the address of the first node of the linked list. The LINK Field of last node contains NULL Value which indicates that it is the end of linked list. It is shown below: Linear Linked List or One Way List or Singly Linked List

2. Doubly Linked List or Two-Way Linked List or Two-Way Chain:-

In it each node is divided into three parts:

1. The first part is PREV part. It is previous pointer field. It contains the address of the node which is before the current node.

2. The second part is the INFO part. It contains the information of the element.

3. The third part is NEXT part. It is next pointer field. It contains the address of the node which is after the current node.

There are two pointers FIRST and LAST. FIRST points to the first node in the list. LAST points to the last node in the list. The PREV field of first node and the NEXT field of last node contain NULL value. This shows the end of list on both sides. This list can be traversed in both directions that is forward and backward.

It is shown below: Doubly Linked List or TwoWay Linked List or TwoWay Chain

3. Circular Linked List:-

In it the last node does not contain NULL pointer. Instead the last node contains a pointer that has the address of first node and thus points back to the first node.

It is shown below:

Circular Linked List

Share this article   |    Print    |    Article read by 42599 times
Author:
Rohit kakria
I am software developer, moderator of xpode.com
Related Articles: No related article
Related Interview Questions: No related interview question