Recursive Fibonacci Time Complexity
Determine the time complexity of the naive recursive Fibonacci function shown above.
public int fib(int n) {
if(n <= 1)
return n;
return fib(n-1) + fib(n-2);
}
A
O(n^2)
B
O(n log n)
C
O(2^n)
D
O(n)
Question Leaderboard
Not enough data yet to show leaderboard.
APFIVE