陕西科技大学学报(自然科学版)2017,Vol.35Issue(1):183-187,5.
一种高效的模式串匹配算法
An efficient pattern matching algorithm for string searching
摘要
Abstract
According to the analysis of the famous BM algorithm and the Horspool algorithm, we propose a simple and efficient pattern matching algorithm for string searching.When a mismatch happens,for shifting the pattern to the right,the shift amount in the Horspool al-gorithm is computed by using the rightmost character of the current text substring to the bad-character strategy.In comparison,the shift amount of our algorithm is the maximum one among all the shift amounts computed by using each of the already-matched characters.The maximum shift amount for each mismatch position of the pattern can be pre-computed by u-sing the pattern only.Experimental results demonstrated that our algorithm can obtain a lar-ger shift amount for a mismatch,and thus enhanced the efficiency of pattern matching for string searching.关键词
模式匹配/字符串匹配/BM算法/Horspool算法Key words
pattern matching/string searching/BM algorithm/Horspool algorithm分类
信息技术与安全科学引用本文复制引用
赵晓,何立风,王鑫,姚斌,巢宇燕,王亚妮..一种高效的模式串匹配算法[J].陕西科技大学学报(自然科学版),2017,35(1):183-187,5.基金项目
国家自然科学基金项目(61601271,61471227,61603234);陕西省科技厅科技计划项目(2016SF-444);陕西省教育厅自然科学专项科研计划项目 ()