On the KMP (Knuth-Morris-Pratt) algorithm

Reference: https://www.zhihu.com/question/21923021/answer/37475572

 

First, what is KMP algorithm

  Baidu it: KMP algorithm is an improved string matching algorithm, proposed by DEKnuth, JHMorris and VRPratt, so people call it Knut - Morris - Pratt operation (referred to as KMP algorithm). The core KMP algorithm using information fails to match, to minimize the number of main string pattern string match to achieve the purpose of fast matching. Specific implementation is implemented by a function next (), local matching function itself contains information pattern string. KMP algorithm time complexity of O (m + n).

 

 
 

Guess you like

Origin www.cnblogs.com/Sansetto/p/11431446.html