Compressing Scrabble Dictionaries
williamedwardscoder.tumblr.com
williamedwardscoder.tumblr.com
- Take a word and sort its characters.
- Add it to a dictionary where the key is the sorted characters and the value is the word.
- If the sorted characters already exist in the dictionary then add it to the list of words for the same key.
This gives O(log n) when you give it a list of letters and you need to find all the possible words.What benefits do GADDAG offer over the above?
A sample implementation (in not very idiomatic Clojure, not touched in years, and using DAWGs instead of GADDAGs): https://github.com/nathell/spleen/blob/master/src/pl/danielj...
The downside is that traversing the tree is a series of linear bit-counting operations---which can be painfully show without a bit of pre-caching.
[1]: http://www.cs.cmu.edu/afs/cs.cmu.edu/project/aladdin/wwwloca...
for those who couldn't find it the first time through.
The article doesn't pretend to invent the GADDAG, nor claim to compress it better than others, only to try and explain how to simplify and pack a GADDAG.
The steps would work on all DAGs generally. This is nothing new, but hopefully its new to some of us and a nice article.