Damn Cool Algorithms, Part 3: Anagram Trees
in Python added by admin, on 24/12/2007 algorithm general intermediate search tree
When it comes to finding anagrams of words, a frequent approach is to use an anagram dictionary - simply put, sort the letters in your word to provide a unique key that all anagrams of a word have in common. Another approach is to generate a letter-frequency histogram for each letter in your word. (Both these approaches are more or less equivalent, in fact.) These approaches make the problem of finding exact single-word anagrams for strings very efficient - O(1) if you use a hashtable.
comment save report- submitted
- Mon, Dec 24th 2007, 07:59
- clicks today
- 0
- clicks this month
- 0
- clicks all time
- 242
