Pattern 6 of 18 · Core Structures

Linked List

Pointer manipulation, fast/slow runners, and in-place reversal.

A chain of nodes, each pointing to the next. No random access like an array, but insertion and deletion at a known position is O(1), and many classic problems come down to careful pointer rewiring.

Key concepts

  • Dummy/sentinel head: a placeholder node before the real head that simplifies edge cases like an empty list or removing the first node.
  • Fast/slow pointers: the fast pointer moves two steps for every one the slow pointer takes — used to find the middle, detect cycles, or find the nth-from-end node.
  • In-place reversal: rewire `next` pointers one at a time, tracking `prev`, `curr`, and `next`.

When to use it

  • The problem explicitly gives you a linked list (reverse it, merge lists, detect a cycle, reorder it).
  • You need O(1) insertion/deletion without shifting elements, unlike an array.

Tips

  • Draw the pointers on paper for reversal/reordering problems — off-by-one pointer bugs are the most common source of errors here.
  • A dummy head node removes almost all "is this the first node?" special-casing.
  • Fast/slow pointers solve cycle detection, middle-finding, and "nth from the end" with the same core technique.

Practice problems (11)

Blind 75 (6):

More from Blind 150 (5):

See the full roadmap →