@ deepikaanand:
I would like to paraphrase Gaurav's approach:
what u have to do is take array a[26]={2,3,5,7,11............. first 26
prime numbers }Now if ur words are EAT and ATE: for EAT.. val1= a[ 'E' - 'A' ] * a [ 'A' - 'A' ] * a[ ' T '- 'A' ]; for ATE: val2= a[ 'A' - 'A' ] * a [ 'T' - 'A' ] * a[ ' E '- 'A' ]; Now if ( val1 == val 2) --> anagrams This will work in all the cases................................. Hope this will help u........... all the best On 13 May 2012 19:07, GAURAV CHAWLA <[email protected]> wrote: > @deepikaanand: > > > 1 is not a prime no. and also ignore 2 as chosen prime no,. > > On Sun, May 13, 2012 at 6:31 PM, deepikaanand <[email protected]>wrote: > >> >> @gaurav >> the approach suggested as : to have an array of 25 prime nos..How is >> it supposed to work ; >> cz(this is wat i have understood) if a :0 ,b:1,c:3,d:5,e:7 >> then be = b + e = 1+7 =8 >> and dc = d + c =5 +3 = 8.. >> >> -- >> 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, > GAURAV CHAWLA > +919992635751 > +919654127192 > > > > > > -- > 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. > -- *Piyush Khandelwal** *Mobile No: 91-8447229204 -- 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.
