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