![]() The exit case is to move 0 disks, i.e., all disks are in the destination peg.Repeat these steps till to reach the exit case. The Tower of Hanoi (also called The problem of Benares Temple 1 or Tower of Brahma or Lucas' Tower 2 and sometimes pluralized as Towers, or simply pyramid puzzle 3) is a mathematical game or puzzle consisting of three rods and a number of disks of various diameters, which can slide onto any rod.By using the same method, move the m-1 discs we just put on Peg B from Peg B to the target peg, i.e., Peg C, so they may be put on top of the disc m without breaking any restrictions.Move the disc m from Peg A to the destination peg, i.e., Peg C, which is a straightforward procedure and follows the general rules.Assuming it does not break the rules, the disc m is now the top disc on Peg A. You can move at most one disk at a time, and you can only put one disk on another if the disk you are putting is smaller or equal to the disk you are putting on to. It is a classic problem where you try to move all the disks from one peg to another peg using only three pegs. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |