Overview of Circularly Linked Lists

11/December/2014 by Valkryst, Updated 29/June/2017

The following post is derived from notes taken while reading through this textbook.

Although the diagram above may not make sense right away, think of each node as holding a reference to the next node in the list. The red node holds a reference to the green node, the green node holds a reference to the blue node, and the blue node holds a reference to the red node.

The difference between a singly linked list and a circularly linked list is that the circularly linked list is continuous. It has no beginning or end. Although it doesn't have a set beginning or end, there is one node that can be thought of as the beginning or the list.

The beginning node is called the cursor. The cursor node is an arbitrary node that is used as a marker to show the beginning of the list. The node at the end of the list is whichever node holds a reference to the cursor node.

All of the code required to use a circularly linked list is almost the same as the code written in the singly linked lists post. Although some modification is necessary to have it work as a circularly linked list.

Additional Information: