Related Articles

Related Articles

GATE | GATE-CS-2007 | Question 45
  • Last Updated : 24 Feb, 2014

What is the time complexity of the following recursive function:

filter_none

edit
close

play_arrow

link
brightness_4
code

int DoSomething (int n) 
{
  if (n <= 2)
    return 1;
  else  
    return (DoSomething (floor(sqrt(n))) + n);
}

chevron_right


(A) \theta(n)
(B) \theta(nlogn)
(C) \theta(logn)
(D) \theta(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

sudo-gate-course

My Personal Notes arrow_drop_up
Recommended Articles
Page :