Question
The famous Tower of Hanoi is a classic problem that involves 3 pegs and n disks of varying size staked on top of each other
The famous Tower of Hanoi is a classic problem that involves 3 pegs and n disks of varying size staked on top of each other from the largest to smallest. (from the bottom to the top). This problem requires you to stack all the disks in the same way but on a different peg following these rules: 1- Only one disk can be moved at a time. 2- Only the upper disk can be moved at each step. 3- No larger disk may be placed on the smaller one. a. Program the Tower of Hanoi problem. Carry out a complete test of your algorithm with n= 2,4,8,16,32 , (up to the largest size of n that your computer can handle You should stop the program if it takes more than 10 minutes to run) and graph its growth rate. b. Find the recurrence relation and time complexity of this algorithm.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started