arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2402.16469cs.DS
收藏

Boyer-Moore字符串匹配算法中好后缀数组的快速实现

A fast implementation of the good-suffix array for the Boyer-Moore string matching algorithm

Thierry Lecroq

AI总结:

本文针对Boyer-Moore算法中好后缀表计算存在冗余操作的问题,基于对模式的精细分析提出一种快速实现,实验证明其两个版本在几乎所有测试场景中均为最快。

摘要:

字符串匹配是在文本中查找模式所有出现位置的问题。该问题已被深入研究,Boyer-Moore字符串匹配算法可能是这一问题最著名的解决方案之一。该算法使用两个预先计算的移位表,分别称为好后缀表和坏字符表。好后缀表在线性时间内计算较为棘手,教科书中的解决方案存在冗余操作。本文基于对模式的精细分析,提出了一种针对该好后缀表的快速实现。实验结果表明,该新实现的两个版本在几乎所有测试场景中都是最快的。

英文摘要:

String matching is the problem of finding all the occurrences of a pattern in a text. It has been intensively studied and the Boyer-Moore string matching algorithm is probably one of the most famous solution to this problem. This algorithm uses two precomputed shift tables called the good-suffix table and the bad-character table. The good-suffix table is tricky to compute in linear time. Text book solutions perform redundant operations. Here we present a fast implementation for this good-suffix table based on a tight analysis of the pattern. Experimental results show two versions of this new implementation are the fastest in almost all tested situations.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑