A circular linked list loops back to the head, forming a cycle
In both singly linked lists and doubly linked lists, we can determine the last node by looking at its next
pointer; a node that points to the NULL
is the last node. In Circular linked list however, there isn’t a node that points to NULL
unless the list itself is empty.
Circular linked list is a list that has no end to it. When you reach the last node, it wraps around back to the head node allowing you to traverse the list from the beginning again.
head last
--------- ---------
| nodeA | --> | nodeB | --> head --> last --> ....
--------- ---------
You can use either singly or doubly linked list to implement a circular linked list. If you need to support backward navigation, you can implement it with doubly linked list as a base. If need forward navigation only, then use singly linked list.