Page 1 of 1
Did anyone work on KMP algorithm? Plz explain it
Posted: Tue Aug 23, 2022 4:46 pm
by lul123
I am learning different pattern searching algorithms. I am kind of stuck with KMP algorithm. I am not able to understand how the time complexity is O(m+n). I think I am not fully getting how the steps work for this algorithm. I already tried multiple resources. It would be helpful if someone who worked on it can explain it in easier terms.
Re: Did anyone work on KMP algorithm? Plz explain it
Posted: Wed Aug 24, 2022 6:47 am
by void
Everything doesn't use the KMP algorithm.
Typically Everything searches are small, so KMP will offer no real-world performance increase.
KMP Algorithm for Pattern Searching
Re: Did anyone work on KMP algorithm? Plz explain it
Posted: Wed Aug 24, 2022 11:28 am
by lul123
Thanks @void.
I found another article which was a bit simpler to understand
https://www.w3spot.com/2020/07/kmp-algo ... glish.html, but it doesn't have code implementation like the one you shared.