Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Describe a recursive algorithm to solve the Tower of Fibonacci puzzle 1. The standard Tower of Hanoi puzzle consists of n circular disks of different

Describe a recursive algorithm to solve the Tower of Fibonacci puzzle
image text in transcribed
1. The standard Tower of Hanoi puzzle consists of n circular disks of different sizes, each with a hole in the center, and three pegs. The disks are labeled 1,2,...,n in increasing order of size. Initially all n disks are on one peg, sorted by size, with disk n at the bottom and disk 1 at the top. The goal is to move all n disks to a different peg, by repeatedly moving individual disks. At each step, we are allowed to move the highest disk on any peg to any other peg, subject to the constraint that a larger disk is never placed above a smaller disk. A recursive strategy that solves this problem using exactly 2"-1 moves is well known (and described in the textbook). This question concerns a variant of the Tower of Hanoi that I'll call the Tower of Fibonacci In this variant, whenever any two disks i-1 and i +1 are adjacent, the intermediate disk i immediately teleports between them; otherwise, the setup, rules, and goal of the puzzle are unchanged. This teleport does not count as a move; on the other hand, the teleport is not optional. For example, the four-disk Tower of Fibonacci can be solved in nine moves (and two teleports, after moves 5 and 8) as follows: LL AL IN an na da 14. Ani 11 A In ribe a recursive algorithm to solve the Tower of Fibonacci puzzle. Briefly justify why your algorithm is correct. (We don't need a complete formal proof of correctness; just convince us that you know why it works.) moves does your algorithm perform, as a function of the number of disks? Prove that your answer is correct. (c) How many teleports does your algorithm induce, as a function of the number of disks? Prove that your answer is correct. For full credit, give exact answers to parts (b) and (c), not just bounds. Express your answers to parts (b) and (c) in terms of the Fibonacci numbers, defined as follows: F = 1 F-1 +F-2 if n=0 if n=1 otherwise 1. The standard Tower of Hanoi puzzle consists of n circular disks of different sizes, each with a hole in the center, and three pegs. The disks are labeled 1,2,...,n in increasing order of size. Initially all n disks are on one peg, sorted by size, with disk n at the bottom and disk 1 at the top. The goal is to move all n disks to a different peg, by repeatedly moving individual disks. At each step, we are allowed to move the highest disk on any peg to any other peg, subject to the constraint that a larger disk is never placed above a smaller disk. A recursive strategy that solves this problem using exactly 2"-1 moves is well known (and described in the textbook). This question concerns a variant of the Tower of Hanoi that I'll call the Tower of Fibonacci In this variant, whenever any two disks i-1 and i +1 are adjacent, the intermediate disk i immediately teleports between them; otherwise, the setup, rules, and goal of the puzzle are unchanged. This teleport does not count as a move; on the other hand, the teleport is not optional. For example, the four-disk Tower of Fibonacci can be solved in nine moves (and two teleports, after moves 5 and 8) as follows: LL AL IN an na da 14. Ani 11 A In ribe a recursive algorithm to solve the Tower of Fibonacci puzzle. Briefly justify why your algorithm is correct. (We don't need a complete formal proof of correctness; just convince us that you know why it works.) moves does your algorithm perform, as a function of the number of disks? Prove that your answer is correct. (c) How many teleports does your algorithm induce, as a function of the number of disks? Prove that your answer is correct. For full credit, give exact answers to parts (b) and (c), not just bounds. Express your answers to parts (b) and (c) in terms of the Fibonacci numbers, defined as follows: F = 1 F-1 +F-2 if n=0 if n=1 otherwise

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions

Question

which step is unrelated to getting an IP from a DHCP server?

Answered: 1 week ago

Question

Design a health and safety policy.

Answered: 1 week ago