Engrain by ByteRush

DSA.08.01 Mid-levelCore — asked often

Pattern 7: Linked list techniques (fast/slow, reversal, dummy)

Comes up in: DSA

This concept is being written. It gets the full five steps — explanation, predict, interview angle, practice with tests, and review cards. Here is exactly what it will cover, so you can study it elsewhere in the meantime.

What it covers

  • reversal (iterative and recursive)
  • fast/slow pointers (cycle, middle)
  • dummy head for merges
  • n-th from end with a gap

Words you will know

fast and slow pointersFloyd's cycle detection

What you will practise

  • reverse-list (E)
  • merge-two-sorted (E)
  • linked-list-cycle (E)
  • remove-nth-from-end (M)
  • reorder-list (M)
  • merge-k-sorted (H)

Interview questions this answers

  • Detect a cycle in a linked list in O(1) space.
  • Reverse a linked list iteratively and recursively.