Question: This problem compares the efficiency of three methods for computing the nth Fibonacci number F n , givenn. Assume that the cost of adding, subtracting,

This problem compares the efficiency of three methods for computing the nth Fibonacci number Fn, given n. Assume that the cost of adding, subtracting, or multiplying two numbers is O(1), independent of the size of the numbers.

a. Show that the running time of the straightforward recursive method for computing Fn based on recurrence (3.22) is exponential in n. 

b. Show how to compute Fn in O(n) time using memoization.

c. Show how to compute Fn in O(lg n) time using only integer addition and multiplication.

This problem compares the efficiency of three methods for computing the nth

d. Assume now that adding two β-bit numbers takes Θ(β) time and that multiplying two β-bit numbers takes ‚(β2) time. What is the running time of these three methods under this more reasonable cost measure for the elementary arithmetic operations?

Step by Step Solution

3.37 Rating (163 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a The running time of the straightforward recursive method ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Introduction to Algorithms Questions!