The Tower of Hanoi Algorithm
Jun Mitani · 2026
There is a famous puzzle called “The Tower of Hanoi.” In this puzzle, each disk has a single hole in the center and is stacked on a pole in descending order of size to form a tower. Once the tower is built on the leftmost pole, the goal is to move it to the rightmost pole. The puzzle comes with two rules: “only one disk can be moved at a time”, and “a larger disk cannot be placed on top of a smaller one”.