The time complexity of the following C function is (assume n > 0) int…
ISRO Scientist/Engineer SC · 2015 · Computer ScienceGATE · 2004 · CS
The time complexity of the following C function is (assume n > 0)
int recursive (int n) {
if(n == 1)
return (1);
else
return (recursive (n-1) + recursive (n-1));
}
- A.
O(n)
- B.
O(n log n)
- C.
O(n2)
- D.
O(2n)
Attempted by 442 students.
Sign up free to check your answer
Sign up freeLoading lesson…