ok.. thanks guys... one doubt now... if this ques is asked in an interview(its already been asked in ms interview)... then u cant just write the code... u hv to explain the whole approach like why u r choosing that way to narrowing dowm the range...
so pls explain how this sol is derived... On Sun, Sep 25, 2011 at 10:15 AM, keyan karthi <[email protected]>wrote: > binary search!!! :) > > > On Sat, Sep 24, 2011 at 11:38 PM, sunny agrawal > <[email protected]>wrote: > >> let x be the number >> initialize ans to some value like x or x/2 >> >> now repeatedly do the following >> ans = (ans + x/ans)/2 >> each time you perform this operation you will move closer to the sqrt >> value and depending upon the precision required stop >> >> >> >> >> On Sat, Sep 24, 2011 at 11:17 PM, siddharth srivastava < >> [email protected]> wrote: >> >>> >>> >>> On 24 September 2011 13:45, shady <[email protected]> wrote: >>> >>>> one of the simplest way is to do binary search... :) >>> >>> >>> +1 >>> >>> >>>> >>>> >>>> On Sat, Sep 24, 2011 at 8:42 PM, teja bala >>>> <[email protected]>wrote: >>>> >>>>> http://www.geeksforgeeks.org/archives/3187 >>>>> >>>>> >>>>> check dis one............. >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Algorithm Geeks" group. >>>>> To post to this group, send email to [email protected]. >>>>> To unsubscribe from this group, send email to >>>>> [email protected]. >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/algogeeks?hl=en. >>>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Algorithm Geeks" group. >>>> To post to this group, send email to [email protected]. >>>> To unsubscribe from this group, send email to >>>> [email protected]. >>>> For more options, visit this group at >>>> http://groups.google.com/group/algogeeks?hl=en. >>>> >>> >>> >>> >>> -- >>> Regards >>> Siddharth Srivastava >>> >>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> >> >> -- >> Sunny Aggrawal >> B.Tech. V year,CSI >> Indian Institute Of Technology,Roorkee >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
