针对QSP算法的研究与分析
DOI:
作者:
作者单位:

作者简介:

通讯作者:

中图分类号:

基金项目:

国家自然基金(61472082);福建省自然基金(2014J01220)


Research and Analysis of QSP Algorithm
Author:
Affiliation:

Fund Project:

  • 摘要
  • |
  • 图/表
  • |
  • 访问统计
  • |
  • 参考文献
  • |
  • 相似文献
  • |
  • 引证文献
  • |
  • 增强出版
  • |
  • 文章评论
    摘要:

    BM算法是经典的单模式匹配算法,QS算法是基于BM算法的改进算法,由于QS算法仅仅分析下一字符T[j+m]计算右移量,整体的匹配效率并不高,因此在QS算法的基础上提出一种改进算法(QSP). QSP算法在预处理阶段从左向右找出模式串中出现1次以上的单字符,计算出这些字符的跳转期望值差,得到最大差值和相对应的字符位置maxPos,并修改skipp2数组的值;在匹配阶段,首先比较P[maxPos]与T[j+maxPos]是否相等,然后再利用两个数组skipp1和skipp2进行右移,保证每次右移的距离达到最大.通过实验证明,该算法总的比较次数和运行时间都低于QS算法,匹配效率得到明显的提高.

    Abstract:

    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 maxPos 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[maxPos] and T[j+maxPos], 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.

    参考文献
    相似文献
    引证文献
引用本文

李莉,江育娥,林劼.针对QSP算法的研究与分析.计算机系统应用,2016,25(3):28-33

复制
分享
文章指标
  • 点击次数:
  • 下载次数:
  • HTML阅读次数:
  • 引用次数:
历史
  • 收稿日期:2015-06-19
  • 最后修改日期:2015-08-17
  • 录用日期:
  • 在线发布日期: 2016-03-17
  • 出版日期:
您是第位访问者
版权所有:中国科学院软件研究所 京ICP备05046678号-3
地址:北京海淀区中关村南四街4号 中科院软件园区 7号楼305房间,邮政编码:100190
电话:010-62661041 传真: Email:csa (a) iscas.ac.cn
技术支持:北京勤云科技发展有限公司

京公网安备 11040202500063号