Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: