Gate CS-2007 Question Paper With Solutions

Q. 9 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);
}

Gate CS-2007 Question Paper With Solutions

Answer: (D)

Explanation:

Gate CS-2007 Question Paper With Solutions

Learn More:   Gate CS-2019 Question Paper With Solutions

LEAVE A REPLY

Please enter your comment!
Please enter your name here