Ask for the Tower of Hanoi program Thank you

Updated on technology 2024-02-09
7 answers
  1. Anonymous users2024-02-05

    The Tower of Hanoi (also known as the Tower of Hanoi) is actually an old Indian legend.

    The god Brama (a god similar to Pangu in China) left three diamond rods in a temple, the first of which was covered with 64 round gold plates, the largest one at the bottom, and the other one smaller than the other, and stacked them one by one, and the monks in the temple tirelessly moved them from one rod to the other one by one, stipulating that one rod in the middle could be used as help, but only one at a time, and the large one could not be placed on top of the small one. The calculation was terrifying (the number of times the disc was moved), and 18446744073709551615 monks would not be able to complete the movement of the disc even if they had exhausted their entire lives.

  2. Anonymous users2024-02-04

    The steps required to complete the Seven Tower of Hanoi are as follows: use 1 to 7 to represent the seven Tower of Hanoi discs, and the radius of the disks is 1<2<3<4<5<6<7;The three pillars of the Tower of Hanoi are represented by ABC, with A being the leftmost, B being the middle, and C being the rightmost;

    1—c means to move disc 1 to the third column, and so on:

    1. 1-c; 2—b;1—b;3—c;1—a;2—c;1—c;4—b;1—b;2—a;

    2. 1-a; 3—b;1—c;2—b;1—c;5—c;1—a;2—c;1—c;3—a;

    III. 1-b; 2—a;1—a;4—c;1—c;2—b;1—b;3—c;1—a;2—c;

    4. 1-c; 6—b;1—b;2—a;1—a;3—b;1—c;2—b;1—b;4—a;

    5. 1-a; 2—c;1—c;3—a;1—b;2—a;1—a;5—c;1—c;2—b;

    6. 1-b; 3—c;1—a;2—c;1—c;4—b;1—b;2—a;1—a;3—b;

    7. 1-c; 2—b;1—b;7—c;1—a;2—c;1—c;3—a;1—b;2—a;

    VIII. 1-a; 4—c;1—c;2—b;1—b;3—c;1—a;2—c;1—c;5—a;

    9.1-b; 2—a;1—a;3—b;1—c;2—b;1—b;4—a;1—a;2—c;

    10. 1-c; 3—a;1—b;2—a;1—a;6—c;1—c;2—b;1—b;3—c;

    11. 1-a; 2—c;1—c;4—b;1—b;2—a;1—a;3—b;1—c;2—b;

    XII. 1-b; 5—c;1—a;2—c;1—c;3—a;1—b;2—a;1—a;4—c;

    XIII, 1-c; 2—b;1—b;3—c;1—a;2—c;1—c;

  3. Anonymous users2024-02-03

    1-7 refers to a disc with a disc radius of 1<2<3<4<5<6<7;ABC refers to the three columns, A is the leftmost, B is the middle, and C is the rightmost; 1—c means to move disc 1 to the third column, and so on:

    1. 1-c; 2—b;1—b;3—c;1—a;2—c;1—c;4—b;1—b;2—a;

    2. 1-a; 3—b;1—c;2—b;1—c;5—c;1—a;2—c;1—c;3—a;

    III. 1-b; 2—a;1—a;4—c;1—c;2—b;1—b;3—c;1—a;2—c;

    4. 1-c; 6—b;1—b;2—a;1—a;3—b;1—c;2—b;1—b;4—a;

    5. 1-a; 2—c;1—c;3—a;1—b;2—a;1—a;5—c;1—c;2—b;

    6. 1-b; 3—c;1—a;2—c;1—c;4—b;1—b;2—a;1—a;3—b;

    7. 1-c; 2—b;1—b;7—c;1—a;2—c;1—c;3—a;1—b;2—a;

    VIII. 1-a; 4—c;1—c;2—b;1—b;3—c;1—a;2—c;1—c;5—a;

    9.1-b; 2—a;1—a;3—b;1—c;2—b;1—b;4—a;1—a;2—c;

    10. 1-c; 3—a;1—b;2—a;1—a;6—c;1—c;2—b;1—b;3—c;

    11. 1-a; 2—c;1—c;4—b;1—b;2—a;1—a;3—b;1—c;2—b;

    XII. 1-b; 5—c;1—a;2—c;1—c;3—a;1—b;2—a;1—a;4—c;

    XIII, 1-c; 2—b;1—b;3—c;1—a;2—c;1—c;

  4. Anonymous users2024-02-02

    2nd floor: 1-3, 2-2, 1-2;

    Three layers: 3-three, 1-one, 2-three, 1-three;

    Four layers: 4-two, 1-two, 2-one, 1-one, 3-two, 1-three, 2-two, 1-two;

    Five layers: 5-three, 1-one, 2-three, 1-three, 3-one, 1-two, 2-one, 1-one, 4-three, 1-three, 2-two, 1-two, 3-three, 1-one, 2-three, 1-three, 1-three;

    Six layers: 6-two, 1-two, 2-three, 1-three, 3-two, 1-one, 2-two, 1-two, 4-one, 1-one, 2-three, 1-three, 3-one, 1-two, 2-one, 1-one, 5-two, 1-three, 2-two, 1-two, 1-two, 3-three, 1-one, 2-three, 1-three, 1-three, 4-two, 1-two, 2-one, 1-one, 3-two, 1-three, 2-two, 1-two;

    Seven layers: 7-three, 1-one, 2-three, 1-three, 3-one, 1-two, 2-one, 1-one, 4-three, 1-three, 2-two, 1-two, 3-three, 1-one, 2-three, 1-three, 5-one, 1-two, 2-one, 1-one, 1-one, 1-one, 3-two, 1-three, 2-two, 1-two, 4-one, 1-one, 2-three, 1-three, 3-one, 1-two, 2-one, 1-one, 6-three, 1-three, 2-two, 1-two, 3-three, 1-one, 2-three, 1-three, 4-two, 1-two, 2-one, 1-one, 3-two, 1-three, 2-two, 2-two, 1-two, 5-three, 1-one, 2-three, 1-three, 3-one, 1-two, 2-one, 1-one, 4-three, 1-three, 2-two, 1-two, 3-three, 1-one, 2-three, 1-three;

  5. Anonymous users2024-02-01

    1. The seven-layer Hanxun Xinnuota game requires at least 127 steps. In fact, the algorithm is very simple, when the number of plates is n, the number of moves should be equal to 2 n 1. Later, an American scholar discovered a surprisingly simple way to do it by taking turns in two steps.

    2. Using the binary recursive tree literature [4], it is pointed out that the recursive algorithm of the Tower of Hanoi problem is very similar to the middle order traversal algorithm of the binary tree mu scatter wheel, so the middle order traversal of the binary tree is used, and it is found that the algorithm steps of the Tower of Hanoi problem can be drawn as a complete binary tree, and the order traversal process is the algorithm step of the Tower of Hanoi problem.

    3. According to the movement law of the Tower of Hanoi introduced in the "Four Discs of the Hannover Tower", click on the left cylinder, pick up the first disc, and put it on the right cylinder. Tap on the left cylinder, pick up the second disc and place it on the middle cylinder. Tap on the right cylinder, pick up the first disc and place it on the middle cylinder.

    4. Later, this legend evolved into the Tower of Hanoi game: there are three poles A, B, and C.

  6. Anonymous users2024-01-31

    The steps required to complete the Seven Tower of Hanoi are as follows: use 1 to 7 to represent the seven Tower of Hanoi discs, and the radius of the disks is 1<2<3<4<5<6<7;ABC is used to represent the three pillars of the Tower of Hanoi, A is the left of the front car, B is the middle, and C is the rightmost;

    1—c means to move disc 1 to the third column, and so on:

    1. 1-c; 2—b;1—b;3—c;Repentance 1-a; 2—c;1-Banquet disturbance c; 4—b;1—b;2—a;

    2. 1-a; 3—b;1—c;2—b;1—c;5—c;1—a;2—c;1—c;3—a;

    III. 1-b; 2—a;1—a;4—c;1—c;2—b;1—b;3—c;1—a;2—c;

    4. 1-c; 6—b;1—b;2—a;1—a;3—b;1—c;2—b;1—b;4—a;

    5. 1-a; 2—c;1—c;3—a;1—b;2—a;1—a;5—c;1—c;2—b;

    6. 1-b; 3—c;1—a;2—c;1—c;4—b;1—b;2—a;1—a;3—b;

    7. 1-c; 2—b;1—b;7—c;1—a;2—c;1—c;3—a;1—b;2—a;

    VIII. 1-a; 4—c;1—c;2—b;1—b;3—c;1—a;2—c;1—c;5—a;

    9.1-b; 2—a;1—a;3—b;1—c;2—b;1—b;4—a;1—a;2—c;

    10. 1-c; 3—a;1—b;2—a;1—a;6—c;1—c;2—b;1—b;3—c;

    11. 1-a; 2—c;1—c;4—b;1—b;2—a;1—a;3—b;1—c;2—b;

    XII. 1-b; 5—c;1—a;2—c;1—c;3—a;1—b;2—a;1—a;4—c;

    XIII, 1-c; 2—b;1—b;3—c;1—a;2—c;1—c;

  7. Anonymous users2024-01-30

    Algorithm steps. Steps to solve the third-order Tower of Hanoi problem.

    It takes 7 steps in total. Fourth-order Tower of Hanoi problem solving steps.

    It takes 15 steps in total.

    Steps to solve a fifth-order Tower of Hanoi problem.

    The algorithm adopts the idea of divide and conquer, and uses the recursive method to complete the movement of the N-layer Hanoi Tower.

    A non-recursive algorithm for the Tower of Hanoi problem.

    The Tower of Hanoi problem can also be solved with the help of non-recursive algorithms, there are many non-recursive algorithms that can solve the Tower of Hanoi problem, the blogger believes that the most common is to use recursion to start a large binary tree, and the following list two non-recursive algorithms.

    1.Make use of binary recursive trees.

    Ref. [4] points out that the recursive algorithm of the Tower of Hanoi problem is very similar to the middle-order traversal algorithm of the binary tree, so the middle-order traversal of the binary tree is used, and it is found that the algorithm steps of the Hanoi Oak Tower problem can be drawn as a complete binary tree, and the order traversal process is the algorithm step of the Hanoi Tower problem.

    function move(n-1,s,e,t) n: number of plates, s: start pile e: target pile t: transition pile.

Related questions