Data structures
Linked lists
Track ownership of every link before rewriting it.
Understand the problem
Use a dummy node to simplify operations at the head. For reversal, save next, redirect current.next to previous, then advance. Slow and fast pointers expose midpoint and cycle structure.
Make it concrete
Reverse 1→2→3 by maintaining a reversed prefix and an untouched suffix.
Trade-offs and pitfalls
Pointer manipulation uses little extra memory but is easy to break through update ordering.
Check your understanding
Explain Floyd cycle detection and why meeting does not necessarily occur at the cycle entry.
Practice this topic