Consider the following function: int unknown(int n){ int i, j, k=0; for…

PYQ GATE 2013

Consider the following function:

int unknown(int n){
    int i, j, k=0;
    for (i=n/2; i<=n; i++)
        for (j=2; j<=n; j=j*2)
            k = k + n/2;
    return (k);
}

The return value of the function is

  1. A.

    Θ(n2)Θ(n^2)

  2. B.

    Θ(n2log⁡n)\Theta(n^2\log n)

  3. C.

    Θ(n3)\Theta(n^3)

  4. D.

    Θ(n3log⁡n)\Theta(n^3\log n)

Attempted by 340 students.

Sign up free to check your answer

Sign up free

Explore the full course: Zero To Hero

Loading lesson…