Hardware Reference
In-Depth Information
Initial state
First move 2 disks
from peg 1 to peg 2
Then move 1 disk
from peg 1 to peg 3
Finally move 2 disks
from peg 2 to peg 3
Figure 5-38. The steps required to solve the Towers of Hanoi for three disks.
machines handle the frame pointer slightly differently, sometimes putting it at the
bottom of the stack frame, sometimes at the top, and sometimes in the middle as in
Fig. 5-40. In this respect, it is worth comparing Fig. 5-40 with Fig. 4-12 to see two
different ways to manage the link pointer. Other ways are also possible. In all
cases, the key is the ability to later be able to do a procedure return and restore the
Search WWH ::




Custom Search