Question d’entretien chez Meta

Implement square root function using basic operations ?

Réponses aux questions d'entretien

Utilisateur anonyme

2 janv. 2011

The first solution is using binary search from 0 to a that is if a > 1, and if a < 1 then search in the interval 0 to 1 and the second solution is to use Newton Raphson's Method with the iterative formula x[n] = x[n-1] - ((x[n-1]*x[n-1]-a)/(2*x[n-1])) and the initial guess x[0] = a/2 and it will converge faster than the binary search

2

Utilisateur anonyme

3 nov. 2010

It is a binary search between 0 and given number. I got it that right but I messed up binary search implementation part.

1

Utilisateur anonyme

17 avr. 2013

http://www.woolor.com/InterviewMitra/97/use-basic-operations-to-create-a-square-root-function