This problem compares the efficiency of three methods for computing the nth Fibonacci number F n ,

Question:

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.

image

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?

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Introduction to Algorithms

ISBN: 978-0262033848

3rd edition

Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest

Question Posted: