Header Linked List
Definition:
A header linked list is linked list that always contain a special note at the front of the list, this special node is called headed node. It does not contain actual data item included in the list but usually contains some useful information about the entire linked list.
Such as
- · Total number of nodes in the list .
- · pointer to the last node in the list or to the last node accessed the header node in the list is never deleted that always point to the first node in the list.
Widely used types of header linked list are:
1.A Grounded Header list is the header list where the last node contains the null pointer . grounded comes from the fact that many text use the electrical ground symbol to indicate the null pointer.
- · Location Of first node is written as:
PTRàLINK(HEAD)
Where as in singly linked list we write it as PTRàHEAD
- · Condition to check empty header linked list:
LINK(HEAD)=NULL
2. circular header list is a header list where the last more points back to the header node .the term node by itself normally refer to an ordinary node not the header node, when used with header list. Thus the first node in header is the node following the header node and the list.
location of the first node is:
- · Location Of first node is written as:
PTRàLINK(HEAD)
- · Condition to check empty Circular header linked list:
LINK(HEAD)=HEAD
Advantage: the main advantage of using head and node in a linked list if that you can avoid the special testing case while inserting and deleting nodes from the linked list.
No comments:
Post a Comment