3 ms·
I wonder if the op compared the performance of this vs "word in set(words)"; tries are very interesting data structures mind.
by alexchamberlain 10y ago
I wonder if the op compared the performance of this vs "word in set(words)"; tries are very interesting data structures mind.
- foobarian 10y agoThe problem with anagrams is you'd have to test all permutations of a word, which is n! hash lookups. Alternately you could store all prefixes in the set and prune the permutations that way. Slightly more interesting than word in set(words).