文件名称:kmp
下载
别用迅雷、360浏览器下载。
如迅雷强制弹出,可右键点击选“另存为”。
失败请重下,重下不扣分。
如迅雷强制弹出,可右键点击选“另存为”。
失败请重下,重下不扣分。
介绍说明--下载内容均来自于网络,请自行研究使用
问题:串的模式匹配算法---KMP
方法:从主串S中寻找模式串T出现的位置。
基本思想:从主串S的第1个字符起和模式串T的第一个字符比较,若相等,则继续逐个比较后续字符;否则从主串的下一个字符再重新和模式的字符比较;依此类推,直到在主串S中找到模式串T的全部字符相匹配为止,这时匹配成功,否则匹配不成功;KMP算法可以在O(n+m)的时间数量级上完成串的模式匹配操作。其改进在于:每当一趟匹配过程中出现字符比较不等时,不需回溯i指针,而得利用已经得到的“部分匹配”的结果将模式向右滑动尽可能远的一段距离后,继续比较。-The problem: string pattern matching algorithm--- KMP method: to find the position of the pattern string T from the main string S. Basic idea: from a character from the main string S and the first character of the mode string T if equal, continue to compare apples to apples Subsequent characters Otherwise, the next character from the main string and re-mode character comparisons and so on, until all of the characters of the pattern string T found in the main string S match, whereupon the matching is successful, otherwise the match is unsuccessful KMP algorithm can be completed in the level of O (n+m) the amount of time the pattern of the string matching operation. The improvement comprising: varying character comparisons, do not need to backtrack to the i pointer has been " partial match" results, derived from the use of sliding mode right as far a distance as possible whenever the trip matching process, continue comparison.
方法:从主串S中寻找模式串T出现的位置。
基本思想:从主串S的第1个字符起和模式串T的第一个字符比较,若相等,则继续逐个比较后续字符;否则从主串的下一个字符再重新和模式的字符比较;依此类推,直到在主串S中找到模式串T的全部字符相匹配为止,这时匹配成功,否则匹配不成功;KMP算法可以在O(n+m)的时间数量级上完成串的模式匹配操作。其改进在于:每当一趟匹配过程中出现字符比较不等时,不需回溯i指针,而得利用已经得到的“部分匹配”的结果将模式向右滑动尽可能远的一段距离后,继续比较。-The problem: string pattern matching algorithm--- KMP method: to find the position of the pattern string T from the main string S. Basic idea: from a character from the main string S and the first character of the mode string T if equal, continue to compare apples to apples Subsequent characters Otherwise, the next character from the main string and re-mode character comparisons and so on, until all of the characters of the pattern string T found in the main string S match, whereupon the matching is successful, otherwise the match is unsuccessful KMP algorithm can be completed in the level of O (n+m) the amount of time the pattern of the string matching operation. The improvement comprising: varying character comparisons, do not need to backtrack to the i pointer has been " partial match" results, derived from the use of sliding mode right as far a distance as possible whenever the trip matching process, continue comparison.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
kmp.pdf