Wednesday 23 January 2013

KMP Algorithm: C/C++ Program

Knuth–Morris–Pratt algorithm

  The Knuth-Morris-Pratt Algorithm (KMP Algorithm) is a string searching algorithm. The performance of KMP Algorithm is far better than the naive string searching algorithm. The time complexity of KMP algorithm is O(m+n). Here m is the length of the text and n is the length of the pattern (sub string) to be searched. KMP algorithm also requires a preprocessing time of the order of O(n).

Click here to download the C Program implemeting KMP Algorithm.
Click here to download the C++ Program implemeting KMP Algorithm.

No comments:

Post a Comment