User:Abhishek ganguly/test1
Appearance
This is a Wikipedia user page. This is not an encyclopedia article or the talk page for an encyclopedia article. If you find this page on any site other than Wikipedia, you are viewing a mirror site. Be aware that the page may be outdated and that the user in whose space this page is located may have no personal affiliation with any site other than Wikipedia. The original page is located at https://en.wikipedia.org/wiki/User:Abhishek_ganguly/test1. |
Towers of Hanoi
[edit]- Recursive algorithm
- move(disks:3, from:A, to:C, using:B)
First move the top 2 disks to the intermediate peg B- move(disks:2, from:A, to:B, using:C)
First move the top 1 disks to the intermediate peg C- move(disks:1, from:A, to:C, using:B)
First move the top 1 disks to the intermediate peg B. As only one disk to be moved, so skip the move-smaller-disks-first branch
Move/display-as-moved the disk no. 1 form peg:A to peg:C
Cleanup the intermediate peg B by moving all of its disks to C
- move(disks:1, from:A, to:C, using:B)
- move(disks:2, from:A, to:B, using:C)