Skip to content

Recursion

Task: Move four discs from A to C, never stacking bigger on smaller

ABC4321MOVES 15 / 15

What you are watching

The Tower of Hanoi with four discs, solved recursively in 15 moves. To move four discs from A to C, the three above the biggest are moved to B, the biggest crosses to C on its own, and the three are moved from B onto it — and each of those three-disc moves is the same problem stated again with a smaller number. The base case is a stack of zero discs, which needs no moves at all. Every extra disc doubles the work, so n discs take 2^n - 1 moves.