Coding & data structures · Linear structures — lists, stacks, queues, and intervals

Linked lists: pointer surgery you can trust

A linked list is the one structure where the pointer is the data, so every bug is an aliasing bug — this lesson builds the three routines every list question is assembled from (in-place reversal, the sentinel node, and the fast/slow pair), proves why Floyd's tortoise and hare must meet, and derives the cycle-start formula instead of memorising it.

26 min read Full lesson in the app Patterns: in-place reversal, sentinel node, fast and slow pointers, Floyd cycle detection

What you'll be able to do

Log in to read the rest of this lesson

A linked list is the one structure where the pointer is the data, so every bug is an aliasing bug — this lesson builds the three routines every list question is assembled from (in-place reversal, the sentinel node, and the fast/slow pair), proves why Floyd's tortoise and hare must meet, and derives the cycle-start formula instead of memorising it. This walkthrough runs about 26 minutes, with runnable code you can edit and re-run as you read. A new account gets 7 days of Pro free, no card required.

Log in to continue

The first module of every track is free to read on the web: see what's open in Coding & data structures.