Java Reference
In-Depth Information
With four disks, the problem's solution requires 15 moves, so it is somewhat difficult to find by
trial and error. With more than four disks, the solution is much more difficult to discover. What we
need is an algorithm that produces a solution for any number of disks. Even though discovering a
solution by trial and error is hard, finding a recursive algorithm to produce the solution is fairly easy.
FIGURE 7-8
The sequence of moves for solving the Towers of Hanoi problem
with three disks
1
2
3
1
2
3
1
2
3
2
3
1
1
2
3
1
2
3
1
2
3
1
2
3
Search WWH ::




Custom Search