You are traversing a circular linked list using the loop `while (current != null) { current = current.next; }`. What happens?
AThe loop terminates correctly when it reaches the last node
BThe loop runs forever, because no node's next pointer is null
CThe loop terminates after visiting half the nodes
DA NullPointerException is thrown on the second pass
In a circular linked list, the last node's next pointer points back to the first node — there is no null sentinel. A null-check termination condition will never be satisfied, causing an infinite loop. You must use a different termination strategy: save a reference to the starting node and stop when you return to it, use a sentinel node, or count iterations.
Question 2 Multiple Choice
You need to merge two circular linked lists, given one pointer to any node in each list. What is the minimum time complexity for this operation?
AO(n) — you must traverse both lists to find all nodes
BO(n log n) — merging requires sorting the two sequences
CO(1) — swap two next pointers to splice the loops together
DO(n²) — each node in one list must be linked to each node in the other
Given a pointer to one node in each circular list, you can merge them in O(1) by swapping two next pointers. Concretely: save A.next and B.next, then set A.next = B's original next and B.next = A's original next. This splices the two loops into one. This is a distinctive advantage of the circular structure — you don't need to find the tail node first, because any node's successor pointer can serve as the splice point.
Question 3 True / False
Circular linked lists are generally faster than singly linked lists for the same sequential access workload.
TTrue
FFalse
Answer: False
Circular linked lists do not offer faster sequential traversal than singly linked lists. Both require O(n) time to visit all n nodes. The circular structure's advantage is structural convenience for wraparound problems (e.g., round-robin scheduling), not raw speed. For most sequential-access tasks, a singly linked list is simpler and less error-prone, because traversal has a natural null terminator.
Question 4 True / False
In a round-robin job scheduler implemented with a circular linked list, advancing from the last job in the list automatically brings you back to the first job without any conditional reset logic.
TTrue
FFalse
Answer: True
This is precisely the structural advantage the circular list provides. Because the last node's next pointer points to the first node, following any node's next pointer wraps around to the beginning. A linear list requires detecting null and resetting the pointer to the head; a circular list makes wraparound implicit in the structure itself, which is why it is the natural data structure for round-robin algorithms.
Question 5 Short Answer
Why does traversing a circular linked list require a different termination condition than traversing a singly linked list, and what are two valid approaches?
Think about your answer, then reveal below.
Model answer: A singly linked list ends with a null pointer, so traversal terminates when current == null. A circular list has no null — the last node points back to the first — so that condition never triggers. Two valid approaches: (1) save a reference to the starting node before the loop and stop when you return to it (current == start); (2) use a sentinel node as a permanent marker and stop when you reach the sentinel.
The null sentinel is the normal structural signal that a linear list has ended. Removing it enables wraparound but transfers the termination burden to the programmer. Failing to account for this is the most common bug when first working with circular lists, and it produces infinite loops that are hard to debug because the program doesn't crash — it just never stops.