- Get link
- X
- Other Apps
Header Linked List
A header linked list is a special type of linked list which contains a header node at the beginning of the list which contains a header node at the beginning of the list. So, in a header linked list START will not point to the first node of the list but START will contain the address of the header node. There are basically two variants of a header linked list.
. Grounded header linked list which stores NULL in the next field of the last node, and
. Circular header linked list which stores the address of the header node in the next field of the last node.
Header Node
Similar to the other linked list, if START=NULL then this denotes an empty header linked list. In order to form a grounded header linked list we need a structure called node that has two fields-DATA and NEXT. The DATA field will store the information part and the NEXT field will store the address of the node sequence. START stores the address of the header node. The NEXT field of the header node stores the address of the first node of the list. This node stores 'H'. The corresponding NEXT field stores the address of the next node.The second data element obtain from address 3 is 'E'. Again we see the corresponding NEXT field,to go to the next address,that is 7 and fetch 'L' as the data. We repeat this procedure until we reach a position where the NEXT entry contains or NULL,as this would denote the end of the linked list. When we traverse the DATA and NEXT in this manner,we will finally see that the linked list in the above example store characters which when put together form the world "HELLO".
Comments
Post a Comment