Question: The recursive algorithm Fib, shown in Figure 1, takes as input an integer n > 0 and returns the n - th Fibonacci number fr.

 The recursive algorithm Fib, shown in Figure 1, takes as inputan integer n > 0 and returns the n - th Fibonacci

The recursive algorithm Fib, shown in Figure 1, takes as input an integer n > 0 and returns the n - th Fibonacci number fr. Algorithm FiB(n): if n = O or n=1 then f=n else f = FIB(n 1) + FIB(n 2) endif; return f Figure 1: Fibonacci Algorithm. Let an be the number of additions made by algorithm Fib(n), i.e., the total number of times the +-function in the else-case is called. Prove that for all n > 0. an = fn+1 -1. The algorithm is not efficient in terms of the total number of operations carried out. Without you having to give the actual such number, can you pin-point exactly where the inefficiency results from

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!