MCQs>IT & Programming>Java>What is the O(n) run-time of the following function? static int fib(int n){ if (n <= 2) return 1; else return fib(n-1) + fib(n-2) }
Java MCQs
What is the O(n) run-time of the following function? static int fib(int n){ if (n <=
2) return 1; else return fib(n-1) + fib(n-2) }
Answer
Correct Answer: O(2^n)
Explanation:
Note: This Question is unanswered, help us to find answer for this one