12 ms·
>It follows that the fastest approach should be to implement the KMP algorithm natively Not exactly - well, depends what you mean by "fastest". The KMP algori
by endtime 16y ago
>It follows that the fastest approach should be to implement the KMP algorithm natively
Not exactly - well, depends what you mean by "fastest". The KMP algorithm is optimal in the worst case, not necessarily in the average case. If you implemented KMP in C and then fed it typical rather than pathological strings, you might still do better with the indexOf algorithm.