Sort the characters in the string. Go through the dictionary sorting the characters in each word in turn. Print the words whose sorted versions match the sorted string.
You can quickly print all equivalence classes of anagrams in the dictionary by hashing with the sorted strings as keys. It only takes a few seconds to get them all this way with a 2-line perl or ruby script. -- 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.