27

Knuth-Morris-Pratt (KMP) Substring Search Algorithm with Java Example

 5 years ago
source link: http://www.solutionfactory.in/posts/Knuth-Morris-Pratt-Substring-Search-Algorithm-with-Java-Example
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
The KMP algorithm is able to search for the substring in O(m+n) time, this is why we don't use the above naive method. Lets now see how this algorithm works.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK