GATE | GATE-CS-2004 | Question 42
What does the following algorithm approximate?
x = m;
y = 1;
while (x - y > e)
{
x = (x + y)/2;
y = m/x;
}
print(x);
|
(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
Last Updated :
28 Jun, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...