Open In App

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/amp/
Quiz of this Question
Article Tags :