| preferred AP College board partner for AP classes
AP Computer Science A/Unit 10: Recursion
Start Practice TestPractice Test
About Exam
hard Solved by 1 students
Recursive Fibonacci Time Complexity
< Prev
Next >

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)

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question

Question Leaderboard

Not enough data yet to show leaderboard.

No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: [email protected]|Privacy Policy