Question: 3. Design recursive algorithms for the following problems: (a) Compute the n-th Fibonacci number Fn. Recall that the n-th Fibonacci number is defined as
3. Design recursive algorithms for the following problems: (a) Compute the n-th Fibonacci number Fn. Recall that the n-th Fibonacci number is defined as follows. 1 Fn = { } Fn-1 + Fn-2 if n = 0, 1, if n > 2. (b) Compute the n-th power of a number x, xn, with n non-negative integer. The algorithm should be designed in such a way that it is possible to write a recur- rence relation for the total number of multiplications executed by the algorithm for which the Master Theorem applies. Write such a recurrence and apply the Master Theorem to obtain an asymptotic bound for it.
Step by Step Solution
3.41 Rating (145 Votes )
There are 3 Steps involved in it
a there are 2 recursive calls work done in each individual recursion is 01 ... View full answer
Get step-by-step solutions from verified subject matter experts
