What does the following algorithm approximate? C x = m; y = 1; while (x - y >…

PYQ GATE 2004

What does the following algorithm approximate?

C

    x = m;
    y = 1;
    while (x - y > e)
    {
        x = (x + y)/2;
        y = m/x;
    }
    print(x);

(Assume m > 1, e > 0).

  1. A.

    log m

  2. B.

    m2

  3. C.

    m1/2

  4. D.

    m1/3

Attempted by 203 students.

Sign up free to check your answer

Sign up free

Explore the full course: Zero To Hero

Loading lesson…