GATE | GATE-CS-2007 | Question 45
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)
(A) A
(B) B
(C) C
(D) D
Answer: (D) Explanation: See Question 5 of
https://www.geeksforgeeks.org/data-structures-and-algorithms-set-11/Quiz of this Question
Last Updated :
28 Jun, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...