Solution: using newton method:
Solving f(x) = 0, using iterative method: x_1 = x_0  f(x_0) / f'(x_0).
So the iterative for sqrt(n) is
y = x/2 + N/(2x)
Implementation:
x = 2^ceil(numbits(N)/2)
loop:
y = floor((x + floor(N/x))/2)
if y >= x
return x
x = y
Tuesday, March 19, 2013
Subscribe to:
Post Comments (Atom)
Manacher's Longest Palindromic Substring Algorithm
http://manacherviz.s3websiteuseast1.amazonaws.com/#/

Given n nonnegative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap aft...

If I decided to invest in energy and natural resources, I will prefer Russian ETFs. Once oil prices go up, Russian stocks will go up as we...

http://manacherviz.s3websiteuseast1.amazonaws.com/#/
No comments:
Post a Comment