[algogeeks] Re: Find valid anagrams
#includeiostream using namespace std; int main() { char s[100]; gets(s); coutsendl; int a[256]={0}; char *ptr=s; while(*ptr!='\0') { a[(int)*ptr]+=1; ptr++; } char s1[100]; gets(s1); couts1endl; int ar[256]={0}; char *pt=s1; while(*pt!='\0') { ar[(int)*pt]+=1; pt++; } int flag=1; for(int i=0;i256;i++) { if(a[i]!=ar[i]) { flag=0; break; } } if(flag==0) coutendlnot anagram; else coutendlanagram; while(1); return 0; } -- 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.
[algogeeks] Re: Find valid anagrams
this find whether two strings are anagrams! -- 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.
[algogeeks] Re: Find valid anagrams
One question wht is the data structure used for the Dictionary ... The algo is dependent on the Implementation of the dictionary . -- 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.
Re: [algogeeks] Re: Find valid anagrams
Use trie for dictionary.Use permutaion to generate all anagrams and check finally. -- 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.
Re: [algogeeks] Re: Find valid anagrams
sort each string according to their alphabetical order then hash it as key, for hashing use preferably linked list as value for key surender On Thu, Jul 21, 2011 at 12:58 AM, SkRiPt KiDdIe anuragmsi...@gmail.comwrote: Use trie for dictionary.Use permutaion to generate all anagrams and check finally. -- 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.
Re: [algogeeks] Re: Find valid anagrams
calculate hash value of word then compare with hash value of source string -- 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.