0
2.7kviews
Define the knuth-moris-pratt algorithm for string matching. Write a function to implement the consept of the same alghorithm.
1 Answer
written 6.1 years ago by | • modified 6.1 years ago |
Knuth–Morris–Pratt string searching algorithm The algorithm was conceived in 1970 by Donald Knuth and Vaughan Pratt, and independently by James H. Morris. Knuth–Morris–Pratt string searching algorithm (or KMP algorithm) searches for occurrences of a "word" W within a main "text string" S by employing the observation that when a mismatch …