Friday, 24 February 2017

Header Linked List


 


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.

  • The special cases inserting or deleting a node either at or from the beginning of the list or from the empty list. In single linked list special cases were handed separately.
  • As header linked list always contains at least one node insertion and deletion to take place only after the head and the special cases of inserting for deletion at the front will never occur to perform the operation on a header linked list.
  • While travelling in order to point to the first we have to use the statement similarly by inserting or deleting a node from sorted header linked list we need to maintain pointer.
 





6 comments: