What is the time complexity of the recursive implementation used to find the nth fibonacci term?

What is the time complexity of the recursive implementation used to find the nth fibonacci term? Correct Answer Exponential

The recurrence relation is given by fibo(n) = fibo(n – 1) + fibo(n – 2). So, the time complexity is given by: T(n) = T(n – 1) + T(n – 2) Approximately, T(n) = 2 * T(n – 1) = 4 * T(n – 2) = 8 * T(n – 3) : : : = 2k * T(n – k) This recurrence will stop when n – k = 0 i.e. n = k Therefore, T(n) = 2n * O(0) = 2n Hence, it takes exponential time. It can also be proved by drawing the recursion tree and counting the number of leaves.

Related Questions

The following sequence is a fibonacci sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21,….. Which technique can be used to get the nth fibonacci term?
Which of the following recurrence relations can be used to find the nth fibonacci number?