Contents    Page-10    Prev    Next    Page+10    Index   

Circularly Linked List

It is possible to have a linked list in which the last link points back to the front of the list rather than to null or nil. This is called a circularly linked list.

This may be convenient for data such as a list of vertices of a polygon, since it makes the data uniform: each vertex is followed by its successor.

Circularly linked lists must be used with care, since they make it easy to write a program that gets into an infinite loop.

A doubly linked list has link pointers that point both forward and backward. This makes it easy to insert or remove items at either end. The Java library uses doubly linked lists.