What is the time complexity of the following recursive function: int…
GATE · 2007 · CS
What is the time complexity of the following recursive function:
int DoSomething (int n)
{
if (n <= 2)
return 1;
else
return (DoSomething (floor(sqrt(n))) + n);
}
- A.
Θ(n²)
- B.
Θ(nlogn)
- C.
Θ(logn)
- D.
Θ(loglogn)
Attempted by 149 students.
Sign up free to check your answer
Sign up freeLoading lesson…