thank you all for the gcd algo 1) is the solution is 2 3 5 2 ?
2) it will not work for double values which is beyond integer range!! 3) this will find the number of 1's in binary representation of x^y.. right? someone explain the CFG question plz.. On Sat, Jul 23, 2011 at 5:58 PM, arun kumar <kumar0...@gmail.com> wrote: > Anna university,chennai > > On Sat, Jul 23, 2011 at 5:52 PM, saurabh singh <saurab...@gmail.com> > wrote: > > where it was written?We had the same question in our MS exam and it was > > never mentioned so. > > > > On Sat, Jul 23, 2011 at 5:46 PM, arun kumar <kumar0...@gmail.com> wrote: > >> > >> the question was for positive number only.:) > >> > >> On Sat, Jul 23, 2011 at 5:42 PM, saurabh singh <saurab...@gmail.com> > >> wrote: > >> > 2 will fail for negatve numbers. > >> > > >> > On Sat, Jul 23, 2011 at 5:33 PM, shady <sinv...@gmail.com> wrote: > >> >> > >> >> thanks a lot arun :) > >> >> > >> >> On Sat, Jul 23, 2011 at 5:27 PM, arun kumar <kumar0...@gmail.com> > >> >> wrote: > >> >>> > >> >>> @ 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 <sinv...@gmail.com> 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 > >> >>> > <dilipmakwa...@gmail.com> > >> >>> > 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 <akshatasharm...@gmail.com > > > >> >>> >> wrote: > >> >>> >>> > >> >>> >>> What about (2)?, will it always work? > >> >>> >>> > >> >>> >>> On Sat, Jul 23, 2011 at 3:13 AM, prasanth > >> >>> >>> <prasanth270...@gmail.com> > >> >>> >>> 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 > algogeeks@googlegroups.com. > >> >>> >>>> To unsubscribe from this group, send email to > >> >>> >>>> algogeeks+unsubscr...@googlegroups.com. > >> >>> >>>> 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 algogeeks@googlegroups.com > . > >> >>> >>> To unsubscribe from this group, send email to > >> >>> >>> algogeeks+unsubscr...@googlegroups.com. > >> >>> >>> 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 algogeeks@googlegroups.com. > >> >>> >> To unsubscribe from this group, send email to > >> >>> >> algogeeks+unsubscr...@googlegroups.com. > >> >>> >> 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 algogeeks@googlegroups.com. > >> >>> > To unsubscribe from this group, send email to > >> >>> > algogeeks+unsubscr...@googlegroups.com. > >> >>> > 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 algogeeks@googlegroups.com. > >> >>> To unsubscribe from this group, send email to > >> >>> algogeeks+unsubscr...@googlegroups.com. > >> >>> 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 algogeeks@googlegroups.com. > >> >> To unsubscribe from this group, send email to > >> >> algogeeks+unsubscr...@googlegroups.com. > >> >> 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 algogeeks@googlegroups.com. > >> > To unsubscribe from this group, send email to > >> > algogeeks+unsubscr...@googlegroups.com. > >> > 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 algogeeks@googlegroups.com. > >> To unsubscribe from this group, send email to > >> algogeeks+unsubscr...@googlegroups.com. > >> 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 algogeeks@googlegroups.com. > > To unsubscribe from this group, send email to > > algogeeks+unsubscr...@googlegroups.com. > > 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 algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > 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 algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.