And yes the formula is derived by the fact that x^(a+b)=x^a*x^b and then think top down with respect to a general variable n.(That is how to split n in the most efficient way such that a+b=n) Thats how I reached to the solution.
On Sat, Jul 30, 2011 at 2:01 PM, saurabh singh <[email protected]> wrote: > Its the method of going mad over optimizing ur solution till it satisfies > ur heart :).... > There is no hard and fast rule.(If there is i am not aware) > > > On Sat, Jul 30, 2011 at 1:59 PM, rShetty <[email protected]> wrote: > >> @amol and saurabh : How exactly is that formula derived for this >> problem ? >> I need to know the method to evaluate such problems in the future . >> Thank you >> >> On Jul 30, 1:13 pm, saurabh singh <[email protected]> wrote: >> > Thanx mate.......You rock.:) >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > On Sat, Jul 30, 2011 at 1:40 PM, Amol Sharma <[email protected]> >> wrote: >> > > i think saurabh you wanted to say this -- >> > >> > > x^n=pow(x^n/2)*pow(x^n/2)*(x^(*n*mod2)) >> > > -- >> > >> > > Amol Sharma >> > > Third Year Student >> > > Computer Science and Engineering >> > > MNNIT Allahabad >> > >> > > On Sat, Jul 30, 2011 at 1:10 PM, Ankur Khurana < >> [email protected]>wrote: >> > >> > >> use divide and conquer . logm complexity . . . >> > >> > >> On Sat, Jul 30, 2011 at 1:09 PM, saurabh singh <[email protected] >> >wrote: >> > >> > >>> o(log n) >> > >>> x^n=pow(x^n/2)*pow(x^n/2)*(x^mod2) >> > >> > >>> the base case pow(x,1)=x pow(x,0)=1 >> > >> > >>> On Sat, Jul 30, 2011 at 1:02 PM, arvind kumar <[email protected] >> >wrote: >> > >> > >>>> Find the least time complexity algorithm(most efficient algo) to >> find >> > >>>> x^m(x to the power of m)..Facebok intern interview question! >> > >> > >>>> -- >> > >>>> 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. >> > >> > >>> -- >> > >>> Saurabh Singh >> > >>> B.Tech (Computer Science) >> > >>> MNNIT ALLAHABAD >> > >> > >>> -- >> > >>> 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. >> > >> > >> -- >> > >> Ankur Khurana >> > >> Computer Science >> > >> Netaji Subhas Institute Of Technology >> > >> Delhi. >> > >> > >> -- >> > >> 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. >> > >> > -- >> > Saurabh Singh >> > B.Tech (Computer Science) >> > MNNIT ALLAHABAD >> >> -- >> 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. >> >> > > > -- > Saurabh Singh > B.Tech (Computer Science) > MNNIT ALLAHABAD > > > -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- 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.
