Stage 1 · Code
Linked Lists
Circular Linked List
Lists where tail connects to head for circular iteration.
5 min readMastering Data Structures & Algorithms for Software Engineering InterviewsCode
Structure
In a circular linked list, the tail's Next points back to head (singly) or head's Prev points to tail (doubly). No nil termination — traversal loops infinitely unless stopped.
Gocircular-linked-list.go
37 linesLn 1, Col 1Go
Tail pointer gives O(1) access to both ends. Head is tail.Next. Traversal stops when we return to head.
Operations
Godelete-and-rotate.go
25 linesLn 1, Col 1Go
Delete needs predecessor (or traverse to find it). Rotate just moves tail pointer — useful for round-robin.
Applications
- Round-robin scheduling: CPU time slices, load balancing.
- Circular buffer/ring buffer: Fixed-size buffer with overwrite.
- Josephus problem: Elimination game.
- Multiplayer games: Turn management.
- Playlist repeat mode: Continuous looping.
Mark this lesson complete to store local progress and unlock a cleaner resume path the next time you visit.