4 ms·
"The algorithm has more complexity to it than I've illustrated (like what happens if you encounter an 'e' in one of the hops?) ..."
by henryw 19y ago
"The algorithm has more complexity to it than I've illustrated (like what happens if you encounter an 'e' in one of the hops?) ..."
- tlrobinson 19y agoHis statement is still incorrect.
- mojuba 19y agoAgreed, I, too, had the feeling that he didn't get the algorithm. In fact, you have to compare every 5th position with all 5 letters of the pattern - p, e, n, 1 and s, (edit) or the other way around, like you said, which can be done nicely by using character sets like in Pascal or bitmaps in C++. Which brings up a question whether this method is any better than, for example, the Intel x86 instruction for linearly scanning strings (the SCAS family, if I'm not mistaken).