Algorithms icon indicating copy to clipboard operation
Algorithms copied to clipboard

KMP in C++

Open Neilblaze opened this issue 6 years ago • 0 comments

KMP is a linear time string matching algorithm. The problem involves finding all occurences where a string pattern matches a substring in a text. The naive approach to string matching involves looping over all indicies over a text string and finding the indicies where the pattern p matches the substring starting at the index.

The worst case of this approach is O(m*(n-m+1)), where m is |p| and n is |text|.

Neilblaze avatar Oct 07 '19 19:10 Neilblaze