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