@ shady:the algo posted by naveen ms is better than eulicd algorithm to find gcd. for more details refer http://en.wikipedia.org/wiki/Binary_GCD_algorithm
On Sat, Jul 23, 2011 at 5:20 PM, shady <[email protected]> wrote: > gcd can always be found in O(log(larger number)) using Euclidean algorithms > , couldn't understand the complexity in that ???? what's the meaning of > O(log UV)^2 ? > > On Sat, Jul 23, 2011 at 5:14 PM, dilip makwana <[email protected]> > wrote: >> >> @Akshata Sharma >> >> (2) double full(double a) >> { >> return (int)(a+0.5); >> } >> >> I tried this on DevC++ , with various inputs ; it is working fine .... >> >> On 23 July 2011 17:00, Akshata Sharma <[email protected]> wrote: >>> >>> What about (2)?, will it always work? >>> >>> On Sat, Jul 23, 2011 at 3:13 AM, prasanth <[email protected]> >>> wrote: >>>> >>>> >>>> the CFG was actually >>>> s->AB >>>> A-> a| BaB >>>> B->bbA >>>> >>>> The false statement i guess was "This grammar doesnt produce a string >>>> of 4 consecutive bs" >>>> >>>> >>>> and 2 or 3 questions mainly focused on j&=j-1 guess this unsets the >>>> rightmost set bit >>>> >>>> >>>> pointer related questions were asked.One such was >>>> >>>> (1)int arr[2][3]={{1,2,3},{4,5,6}}; >>>> int (*ptr)[3]=&a[0]; >>>> printf("(%d,%d)",(*ptr)[1],(*ptr)[2]); >>>> ptr+=1; >>>> printf("(%d,%d)",(*ptr)[1],(*ptr)[2]); >>>> >>>> find the output??? >>>> >>>> (2) double full(double a) >>>> { >>>> return (int)(a+0.5); >>>> } >>>> >>>> does this always work?? >>>> >>>> (3) int x=123,y=231; >>>> int t=0; >>>> int l; >>>> l=x^y; >>>> while(l) >>>> { >>>> t++; >>>> l&=l-1; >>>> } >>>> printf("%d",t); >>>> >>>> -- >>>> 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. >> >> >> >> -- >> Dilip Makwana >> VJTI >> BTech Computers Engineering >> 2009-2013 >> >> -- >> 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.
