What is Circular Linked List ? What are Advantages and Disadvantages of 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:
Advantages:
1. If we are at a node, then we can go to any node. But in linear linked list it is not possible to go to previous node.
2. It saves time when we have to go to the first node from the last node. It can be done in single step because there is no need to traverse the in between nodes. But in double linked list, we will have to go through in between nodes.
Disadvantages:
1. It is not easy to reverse the linked list.
2. If proper care is not taken, then the problem of infinite loop can occur.
3. If we at a node and go back to the previous node, then we can not do it in single step. Instead we have to complete the entire circle by going through the in between nodes and then we will reach the required node.
http://
http://
Contributed by:
Rohit kakria
I am software developer, moderator of xpode.com
Resourse address on xpode.com
http://www.xpode.com/Print.aspx?Articleid=296
Click here to go on website
|