Same method as Gene told.
Only enhancement u can made is start from the word nearer to sorted string
and compare till the nearest word of the reverse of sorted string.
You don't need to check the whole dictionary.

Anuj Agarwal

Engineering is the art of making what you want from things you can get.


On Wed, May 18, 2011 at 6:01 AM, Gene <gene.ress...@gmail.com> wrote:

> 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.
>

-- 
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.

Reply via email to