Header, Grounded header and Circular Linked Lists in Data Structures

Header Linked List

A header linked list is a linked list which always contains a special node, called the ‘header node’, at the beginning of the list. The following are two kinds of widely used header lists:
header linked list
Header Linked List

Grounded Header List

A grounded header list is a header list where the last node contains the null pointer. (The term “grounded” comes from the fact that many texts use the electrical ground symbol to indicate the null pointer.)
Grounded header linked list
Grounded and Circular Header Link List

Circular Header List

A circular header list is a header list where the last node points back to the header node.

Traversing into Circular header list

Algorithm: (Traversing a circular header list.)
TRVRS(INFO, LINK, START, PTR).

Let LIST be a circular header list in memory. This algorithm traverses LIST, applying an operation to PRINT each node of LIST.

Step I: Set PTR := LINK[START]. [Initializes the pointer PTR.]

Step II: Repeat steps 3 and 4 while PTR != START:

Step III: PRINT: INFO[PTR].
[Print information of node.]

Step IV: Set PTR := LINK[PTR].
[PTR now points to the next node.]
[End of step 2 loop.]

Step V: Exit.

Powered by Blogger.