Re:Guess my word
by bonobo3000 on Saturday September 05, 2015 @08:02AM
(#10174591)
This is great! Inspired me to make a little script in spark-shell:
I love HN, and I love scala :D Thanks for posting OP. HN needs more great technical content like this and less opinion & news, in my opinion.
[ Parent
| on HN ]
This raises an interesting problem--could we find the word even faster by using something other than a standard binary search?
The first thing that comes to mind is skipping past letters that don't appear very often at that point in a word with the current prefix--or to be more granular, you could change your counter (here g) to a float and somehow weight each letter by how rarely it occurs after the letters you've established so far. So if you've currently established that the first four letters are "pro," and "z" almost never occurs after those letters, "z" might be given a weight above 1 so the counter skips right past it.