GATE | GATE-CS-2004 | Question 42

What does the following algorithm approximate?

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


(Assume m > 1, e > 0).

(A) log m
(B) m2
(C) m1/2
(D) m1/3


Answer: (C)

Explanation: The given code is implementation of Babylonian method for square root

Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

1


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.