期刊文献+

针对QSP算法的研究与分析 被引量:1

Research and Analysis of QSP Algorithm
下载PDF
导出
摘要 BM算法是经典的单模式匹配算法,QS算法是基于BM算法的改进算法,由于QS算法仅仅分析下一字符T[j+m]计算右移量,整体的匹配效率并不高,因此在QS算法的基础上提出一种改进算法(QSP).QSP算法在预处理阶段从左向右找出模式串中出现1次以上的单字符,计算出这些字符的跳转期望值差,得到最大差值和相对应的字符位置max Pos,并修改skipp2数组的值;在匹配阶段,首先比较P[max Pos]与T[j+max Pos]是否相等,然后再利用两个数组skipp1和skipp2进行右移,保证每次右移的距离达到最大.通过实验证明,该算法总的比较次数和运行时间都低于QS算法,匹配效率得到明显的提高. BM algorithm is a classical single pattern matching algorithm. QS algorithm is an improved algorithm of BM algorithm. Because computing the moving distance to right position only by analyzing the character T[j+m], the overall matching efficiency of QS is not high. Therefore, an improved algorithm(QSP) accordingly to the QS algorithm is proposed. The core idea of QSP algorithm is finding all characters that appear more than once in the pattern string from left to right, calculating the jumping expectation difference value of these characters, getting the highest expectation difference value and max Pos value that is the position of it in the preprocessing phase, and changing the value of skipp2 array. During the matching phase, in order to move the pointer farthest at each time, it firstly considers the relationship between P[max Pos] and T[j+max Pos], then moves to right by using the skipp1 and skipp2 arrays. The experimental result shows that the comparison number and matching time of QSP are less than QS. Its efficiency has been improved obviously.
出处 《计算机系统应用》 2016年第3期28-33,共6页 Computer Systems & Applications
基金 国家自然基金(61472082) 福建省自然基金(2014J01220)
关键词 模式匹配 QS算法 QSP算法 跳转期望值差 pattern matching QS algorithm QSP algorithm jumping expectation difference value
  • 相关文献

参考文献12

二级参考文献46

  • 1钱颖,刘国华,陈子阳,赵孟.模式匹配技术[J].燕山大学学报,2006,30(4):340-344. 被引量:1
  • 2张娜,张剑.一个快速的字符串模式匹配改进算法[J].微电子学与计算机,2007,24(4):102-105. 被引量:11
  • 3Knuth D E,Morris J H,Pratt V R.Fast Pattern Matching in Strings[J].SIAM Journal on Computing,1977,6(2):323-350.
  • 4Boyer R S,Moore J S.A Fast String Searching Algorithm[J].Communications of the ACM,1977,20(10):762-772.
  • 5Sunday D M.A Very Fast Substring Search Algorithm[J].Communications of the ACM,1990,33(8):132-142.
  • 6Aho A V,Corasick M J.Efficient String Matching:An Aid to Bibliographic Search[J].Communications of the ACM,1975,18(6):330-340.
  • 7Wu Sun,Manber U.A Fast Algorithm for Multi-pattern Searching[Z].Taiwan,China:Department of Computer Science,Chung-Cheng University,1994.
  • 8Commemtz W R.A String Matching Algorithm Fast on the Average[C] //Proceedings of the 6th Colloquium on Automata,Languages and Programming.[S.l.] :Springer-Verlag,1979.
  • 9BOYER R S, MOORE J S. A fast string searching algorithm [ J]. Communications of the ACM, 1977, 20(10) : 762 -772.
  • 10HORSPOOL R N. Practical fast searching in strings [ J]. Software Practice and Experience, 1980, 10(6): 501 -506.

共引文献37

同被引文献2

引证文献1

相关作者

内容加载中请稍等...

相关机构

内容加载中请稍等...

相关主题

内容加载中请稍等...

浏览历史

内容加载中请稍等...
;
使用帮助 返回顶部