Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Why is a linked list called a circular linked list?


Asked by Kade Lloyd on Dec 06, 2021 FAQ



In fact in the list every node points to the next node and last node points to the first node, thus forming a circle. Since it forms a circle with no end to stop hence it is called as circular linked list. In circular linked list there can be no starting or ending node, whole node can be traversed from any node.
Just so,
While in case of doubly linked list it has 2 pointer i.e. pointer to forward node and pointer to next node. In circular linked list last node will point to first node while in doubly linked list last node will point to previous as well as null.
Similarly, In a doubly circular linked list, the previous pointer of the first node is connected to the last node while the next pointer of the last node is connected to the first node. Its representation is shown below. We can declare a node in a circular linked list as any other node as shown below:
One may also ask,
There is no NULL at the end. A circular linked list can be a singly circular linked list or doubly circular linked list. 1) Any node can be a starting point.
Furthermore,
Circular linked list In the last node of a list, the link field often contains a null reference, a special value is used to indicate the lack of further nodes.