3 ms·
I guess it depends on profiling real world behaviour. If you walk the list only a few times because long words are present, that's better than walking the list
by Waterluvian 8y ago
I guess it depends on profiling real world behaviour. If you walk the list only a few times because long words are present, that's better than walking the list once and for each character, walking your set of words. Or if most words aren't a match early on, you'll cull the candidate set pretty quickly.
Yeah I'm convinced I wouldn't bother with something beyond my basic idea until I profile.
- tylerhou 8y agoYes, I missed that you can drop candidates whose lengths are less than your longest match so far. So a set might be better.