Location:
Search - kmp java simple
Search list
Description: 串的模式匹配的朴素算法是O(N^2)的, 可以
利用KMP(由D.E.Knuth, J.H.Morris, V.R.Pratt提出)算法改进至线性的算法. KMP算法与朴素算法的不同在于:处理"失配"情况. 不同于将指针完全回溯, KMP算法先根据已经部分匹配的信息, 将匹配的指针跳过不必匹配的位置.-Series of simple pattern matching algorithm is O (N ^ 2), and can make use of KMP (from DEKnuth, JHMorris, VRPratt made) algorithm to improve the algorithm to linear. KMP algorithm and simple algorithm is different: the " mismatch" situation. pointer completely different to back, KMP algorithm first part of the basis of information match, the pointer will skip the match do not have to match the position.
Platform: |
Size: 1024 |
Author: 左刘鸿翔 |
Hits: