Intuition The ONE core idea
A circular linked list is a chain of boxes where the very last box points back to the first box instead of pointing to "nothing." Because of that single loop-back, you can start anywhere and keep walking forever, always returning to where you began — which is exactly what "taking turns in a circle" needs.
Before you can apply a circular linked list, you must be able to read every symbol the parent note throws at you. This page assumes nothing . We build each idea, draw it, and only then use it.
A node is one little box in memory that holds two things:
a piece of data (a number, a name, a task…),
an arrow called next that says "the box that comes after me is over there."
Think of one train carriage: it carries cargo (data) and has a coupler pointing to the next carriage (next).
We need this because everything below is just nodes wired together in different shapes . A linked list is nothing but "which node does each next arrow point at?"
next
A pointer is an arrow that stores the location of another node — not the node itself, just "it's over there." We write p.next to mean "the node that p's arrow points to."
Intuition Why arrows and not copies?
If each box physically contained the next box, boxes would nest forever. Instead each box just remembers where the next one lives. Cheap, and you can rewire the chain by moving one arrowhead.
Read p.next out loud as "p-dot-next" = "follow p's arrow one step." That dot . just means "the field inside this node."
null
null means the arrow points at nothing — a dead end. In a picture it's an arrow going into empty space (often drawn as a ground symbol ⏚ or the word null).
Intuition Why the parent note keeps saying "no null"
A normal Singly Linked List ends when some node's next is null — that's how you know to stop walking. The whole trick of a circular list is that it has no null ; the last arrow curls back to the first node. So "no null" is not a minor detail — it's the entire personality of the structure.
Compare the two pictures above:
Top (normal list): the red arrow on the last node points to null → you stop there.
Bottom (circular list): that same arrow (now green) bends back to the head → there is no stopping point built in.
head = a pointer to the first node — where you conventionally start.
tail = a pointer to the last node — the one whose next loops back.
tail is the smart pointer to keep
In a circular list, tail.next is the head (the last arrow points to the first). So if you only remember the tail, you get the head for free by following one arrow. One pointer, both ends, in one step. That is why the parent note says "store tail, derive head."
Symbolically: head = tail.next .
Definition Big-O notation
O ( something ) is a shorthand for "how does the work grow as the list gets bigger?" Let n = number of nodes.
O ( 1 ) = constant work: same effort no matter how big the list. (Rewiring one arrow.)
O ( n ) = linear work: effort grows in proportion to n . (Walking every node once.)
Intuition Why we care here
Deleting a person in the Josephus Problem , or inserting at the front of a scheduler queue, must be O ( 1 ) — otherwise a big circle gets slow. The parent claims deletion "is O ( 1 ) "; that only means "we rewire exactly one arrow, and that never depends on n ."
The picture shows a deletion: we hold prev (the node just before the victim) and set prev.next = victim.next. One arrow moves. The victim is now unreachable — gone. It didn't matter whether the circle had 5 nodes or 5 million: still one move → O ( 1 ) .
A do–while loop runs the body once first , then checks the condition to decide whether to repeat. Contrast a plain while, which checks before running even once.
Intuition Why a CLL forces do–while
We start with p = head and want to stop when we come back: p != start. But at the very first check, p already equals start, so a plain while (p != start) would stop immediately and visit nothing. A do–while visits the head first, then checks — so the loop actually runs.
Common mistake "I'll stop at
p == null."
Why it feels right: every normal-list loop ends at null.
Why it's fatal: a CLL has no null, so p never becomes null → infinite loop.
Fix: stop at p == start, using do–while.
Definition Self-loop node
When a circular list has exactly one node, that node's next must point to itself : node.next = node. Its arrow curls straight back into its own tail.
Intuition Why this weird case exists
"Last node points to first node" — but if there's only one node, it is both first and last. So it must point to itself, or the loop is broken. This is the base case every insertion routine special-cases.
Pointer p.next follows one step
No null = loop back to head
Self-loop node.next equals node
do-while stop at p equals start
Circular Linked List applications
Each foundation feeds the next; together they let the parent topic talk about Round-Robin Scheduling , Ring Buffer , the Josephus Problem , and Fibonacci Heap without you tripping on a symbol.
A Singly Linked List is the same chain but the last next is null (a line, not a loop).
A Doubly Linked List adds a prev arrow to each node; its circular cousin lets you walk both directions round the ring.
A Queue built on a Ring Buffer is the array-flavoured version of "wrap around."
Head back to the parent whenever you're ready: Circular linked list — applications .
Test yourself — cover the right side.
What is a node made of? A data field plus a next arrow (pointer) to another node.
What does p.next mean? "Follow p's arrow one step" — the node p points to.
What does null represent, and why does a CLL avoid it? A dead-end arrow to nothing; a CLL loops the last node back to the head so there is no dead end.
In a circular list, what is tail.next equal to? The head node (the last arrow points to the first).
Why keep tail instead of head? tail.next gives the head for free, so one pointer reaches both ends in O ( 1 ) .
What does O ( 1 ) mean for deletion? We rewire exactly one arrow (prev.next = victim.next); the cost never grows with list size n .
Why must CLL traversal use a do–while, not a while? A plain while (p != start) stops instantly since p == start at the start; do–while visits the head once before checking.
What must the single node in a one-element CLL point to? Itself — node.next = node.