Every linked list operation is built from the same three moves: walk with a pointer, save the arrow you're about to change, and re-point an arrow. This lesson builds the everyday operations from those moves, in four languages.
Most problems hand you a list, but for testing you'll often want to build one. The trick is a dummy node in front: it gives the loop a place to attach the first real node, so there's no special case for an empty list.
Free account
Sign up to read the rest of this lesson: 6 more sections, 4 drawings, 2 dry-run simulators and code in JavaScript, Python, Java and C++.
Still to come