# Towers of Hanoi. There is a story about Buddhist monks who are playing this puzzle with 64 stone…

Towers of Hanoi.

There is a story about Buddhist monks who are playing this puzzle with

64 stone disks. The story claims that when the monks finish moving the disks from one

post to a second via the third post, time will end. Eschatology (concerns about the end of

time) and theology will be left to those better qualified; our interest is limited to the recur-

sive solution to the problem.

A stack of n disks of decreasing size is placed on one of three posts. The task is to move the

disks one at a time from the first post to the second. To do this, any disk can be moved

from any post to any other post, subject to the rule that you can never place a larger disk

over a smaller disk. The (spare) third post is provided to make the solution possible. Your

task is to write a recursive function that describes instructions for a solution to this problem. We don’t have graphics available, so you should output a sequence of instructions

that will solve the problem.

Hint:

If you could move n-1 of the disks from the first post to the third post using the

second post as a spare, the last disk could be moved from the first post to the second post.

Then by using the same technique (whatever that may be) you can move the

n-1 disks

from the third post to the second post, using the first disk as a spare. There! You have the

puzzle solved. You only have to decide what the non-recursive case is, what the recursive case

is, and when to output instructions to move the disks.

I am expecting to see the following sample output from a run of this program:

RUN 1:

TOWERS of Hanoi
Enter a number of disks to play. I’ll give necessary moves.
3
Move a disk from post A to post B
Move a disk from post A to post C
Move a disk from post B to post C
Move a disk from post A to post B
Move a disk from post C to post A
Move a disk from post C to post B
Move a disk from post A to post B

Process returned 0 (0x0) execution time : 4.788 s
Press any key to continue.

——————————————

RUN 2

TOWERS of Hanoi
Enter a number of disks to play. I’ll give necessary moves.
4
Move a disk from post A to post C
Move a disk from post A to post B
Move a disk from post C to post B
Move a disk from post A to post C
Move a disk from post B to post A
Move a disk from post B to post C
Move a disk from post A to post C
Move a disk from post A to post B
Move a disk from post C to post B
Move a disk from post C to post A
Move a disk from post B to post A
Move a disk from post C to post B
Move a disk from post A to post C
Move a disk from post A to post B
Move a disk from post C to post B

Process returned 0 (0x0) execution time : 7.769 s
Press any key to continue.

Calculate the price
Pages (550 words)
\$0.00
*Price with a welcome 15% discount applied.
Pro tip: If you want to save more money and pay the lowest price, you need to set a more extended deadline.
We know how difficult it is to be a student these days. That's why our prices are one of the most affordable on the market, and there are no hidden fees.

Instead, we offer bonuses, discounts, and free services to make your experience outstanding.
How it works
Receive a 100% original paper that will pass Turnitin from a top essay writing service
step 1
Fill out the order form and provide paper details. You can even attach screenshots or add additional instructions later. If something is not clear or missing, the writer will contact you for clarification.
Pro service tips
How to get the most out of your experience with MyhomeworkGeeks
One writer throughout the entire course
If you like the writer, you can hire them again. Just copy & paste their ID on the order form ("Preferred Writer's ID" field). This way, your vocabulary will be uniform, and the writer will be aware of your needs.
The same paper from different writers
You can order essay or any other work from two different writers to choose the best one or give another version to a friend. This can be done through the add-on "Same paper from another writer."
Copy of sources used by the writer
Our college essay writers work with ScienceDirect and other databases. They can send you articles or materials used in PDF or through screenshots. Just tick the "Copy of sources" field on the order form.
Testimonials
See why 20k+ students have chosen us as their sole writing assistance provider
Check out the latest reviews and opinions submitted by real customers worldwide and make an informed decision.
Awesome job, Thank you
Customer 453201, June 12th, 2022
Nursing
Thank you
Customer 453087, March 5th, 2022
Literature
Thank you!
Customer 453145, April 19th, 2022
Psychology
quick, fast and exact!
Customer 453027, May 24th, 2022
English 101
very good paper thank you.
Customer 453083, February 18th, 2022
Nursing
thank you so much
Customer 452749, June 10th, 2021
Psychology
thank you!
Customer 452947, October 21st, 2021
Education
Very fast response and did a excellent job.
Customer 453201, May 31st, 2022
Psychology
quick and before due date/time.
Customer 453027, January 29th, 2022
Health Care
awesome work
Customer 452777, October 14th, 2021
awesome work
Customer 453201, June 15th, 2022
Psychology
Came in as promissed. Good paper.
Customer 453027, January 6th, 2022
11,595
Customer reviews in total
96%
Current satisfaction rate
3 pages
Average paper length
37%
Customers referred by a friend
Use a coupon FIRST15 and enjoy expert help with any task at the most affordable price.
Claim my 15% OFF Order in Chat

Are You Looking For Assignment Help? We Can Certainly Assist You