DEV Community

loading...

Discussion on: The algorithm behind Ctrl + F.

Collapse
maowtm profile image
maowtm

KMP is definitely O(m+n) even in worst case, because after the table construction (O(m)) it's just a linear scan on the string (O(n)).

Thread Thread
akhilpokle profile image
Akhil Author

Thanks for sharing! Updated!