What is a circular linked list?

Answer

A circular linked list is a linked list where the last node points back to the first node (head), forming a circle. Types: Singly circular: last node's next pointer → head; Doubly circular: last node's next → head, head's prev → last node. Properties: (1) No null pointer at the end; (2) Can start traversal from any node; (3) Useful for cyclic/repeated processing; (4) Requires careful loop termination (stop when you reach the start again). Operations: traverse with do-while loop; insert/delete require updating circular pointers; detecting: check if node.next == head. Applications: (1) Round-robin scheduling — OS cycles through processes; (2) Multiplayer board games — cycle through players; (3) Media players — playlist looping; (4) Circular buffer/ring buffer — fixed-size buffer that wraps around; (5) Conway's Game of Life; (6) Josephus problem. Detecting a cycle in a general linked list (not necessarily circular from the start) uses Floyd's cycle detection algorithm (fast/slow pointers). Circular linked list differs from a linked list with a cycle — in circular, the cycle is intentional and known (last node → head).