首页 | 本学科首页   官方微博 | 高级检索  
     

一种改进的BM字符串匹配算法
引用本文:李韦男,虞慧群.一种改进的BM字符串匹配算法[J].计算机工程与应用,2014,50(16):104-108.
作者姓名:李韦男  虞慧群
作者单位:1.华东理工大学 计算机科学与工程系,上海 200237 2.计算机软件评测重点实验室,上海 201112
摘    要:经典字符串匹配算法的本质都是从左向右或者从右向左顺序进行字符匹配的,在主串中存在大量子串与模式串前缀或者后缀相同时效率较低,并且模式串最大右移长度为模式串长度。改进算法采用二分匹配字符串的方法,有效地避免了由主串中大量子串与模式串前缀相同或者后缀相同引起的无意义比较次数。模式串的移动距离根据改进的坏字符规则进行计算,增大了模式串的移动距离。实验结果表明,改进的字符串匹配算法可以有效地减少字符串的匹配次数和移动次数,达到了提高算法效率的目的。

关 键 词:匹配  模式串  主串  入侵  

Improved string matching algorithm based on BM
LI Weinan,YU Huiqun.Improved string matching algorithm based on BM[J].Computer Engineering and Applications,2014,50(16):104-108.
Authors:LI Weinan  YU Huiqun
Affiliation:1.Department of Computer Science and Engineering, East China University of Science and Technology, Shanghai 200237, China 2.Shanghai Key Laboratory of Computer Software Evaluating and Testing, Shanghai 201112, China
Abstract:The essence of classical string matching algorithms is sequential character matching which is always from left to right or from right to left. In the main string, if there are many substrings which have the same prefix or suffix with the pattern string, the algorithms are in the low efficiency. The maximum length for the shift is the length of the pattern string. The improved algorithm uses the two-string-separate-comparison method, effectively avoiding meaningless comparison times due to the same prefix or suffix of substrings and the pattern string. Since the algorithm calculates moving distance of the pattern string according to the improved bad character rule, it increases moving distance of the pattern string. The experimental results show that the improved string matching algorithm can effectively reduce the string matching times and moving times to improve the algorithm efficiency.
Keywords:matching  pattern string  main string  intrusion  
本文献已被 CNKI 等数据库收录!
点击此处可从《计算机工程与应用》浏览原始摘要信息
点击此处可从《计算机工程与应用》下载全文
设为首页 | 免责声明 | 关于勤云 | 加入收藏

Copyright©北京勤云科技发展有限公司  京ICP备09084417号