logoalt Hacker News

11 Nanoseconds per Word: Over-Optimizing Anagrams

25 points • by ColinWright • yesterday at 9:57 AM • 4 comments • view on HN

Comments

mrandish • today at 7:10 AM

> that I hadn't seen before (though the history of computing is long and Knuth probably noticed it in 1965).

I love that aside. Probably would make a good T-shirt or bumper sticker, like: "Congrats on that clever algorithm you just came up with! Just remember... the history of computing is long and Knuth probably noticed it in 1965.

wood_spirit • today at 5:48 AM

This reminds me fondly of things I used to do for programming contests :)

I think I did an anagram dictionary once. My memory is that I computed the anagrams once ever and made a dictionary file which was a sorted word list and the offset of the next anagram of that word. The sorted letters for each anagram group were also in the same list. Because it was searching for multiple word phrases you just did a search on the subsets of letters left for candidates.

Scrabble dictionaries were the most mind bending I think. I don’t think I wrote anagrams up but this is the scrabble one https://williame.github.io/post/87682811573.html

oguz-ismail2 • today at 5:44 AM

If the dictionary is static what's the point of building a hashtable out of it at runtime? If it's not how do we know this'll work with a different dictionary? I didn't know about Gödel numbering though, that part is cool.

nilail • today at 8:01 AM

Really interesting !

yksalun • today at 7:07 AM

[flagged]