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

Word-RAM模型中最坏情况下有效的单个和多个字符串匹配

Worst case efficient single and multiple string matching in the Word-RAM model

Djamal Belazzougui

摘要:

在本文中,我们探讨了字符串的单匹配和多匹配问题的最坏情况下的解决方案,在字RAM模型与字长w。在第一个问题中,我们必须基于长度为m的模式p在大小为sigma的字母表上构建一个数据结构,以便我们可以回答以下查询:给定长度为n的文本T,其中每个字符使用log(sigma)位进行编码,返回T中所有p出现的位置(在下文中,我们用occ表示报告出现的次数)。对于多模式匹配问题,我们有一个总长度为m的d个模式的集合S,对文本T的查询包括找到S中的模式在T中的所有出现的所有位置。由于文本的每个字符都使用log sigma位进行编码,并且我们可以在RAM模型中以恒定时间读取w位,因此我们假设我们可以在一个时间步长中读取文本的(w/log sigma)个连续字符。这意味着这两个问题的最快可能的查询时间是O((n(log sigma/w)+occ)。在本文中,我们提出了几个不同的结果,这两个问题接近最佳的查询时间。我们首先提出了两种不同的线性空间数据结构的第一个和第二个问题:第一个回答单一的模式匹配查询的时间为O(n(1/m+log sigma/w)+occ),而第二个回答多个模式匹配查询的时间为O(n((log d+log y+log log d)/y+log sigma/w)+occ),其中y是最短的模式在多模式匹配的情况下的长度。然后,我们将展示如何一个简单的应用程序的四个俄罗斯技术允许获得数据结构的查询时间独立的最短模式的长度(唯一的模式的长度的情况下,单字符串匹配)在使用更多的空间为代价。

英文摘要:

In this paper, we explore worst-case solutions for the problems of single and multiple matching on strings in the word RAM model with word length w. In the first problem, we have to build a data structure based on a pattern p of length m over an alphabet of size sigma such that we can answer to the following query: given a text T of length n, where each character is encoded using log(sigma) bits return the positions of all the occurrences of p in T (in the following we refer by occ to the number of reported occurrences). For the multi-pattern matching problem we have a set S of d patterns of total length m and a query on a text T consists in finding all positions of all occurrences in T of the patterns in S. As each character of the text is encoded using log sigma bits and we can read w bits in constant time in the RAM model, we assume that we can read up to (w/log sigma) consecutive characters of the text in one time step. This implies that the fastest possible query time for both problems is O((n(log sigma/w)+occ). In this paper we present several different results for both problems which come close to that best possible query time. We first present two different linear space data structures for the first and second problem: the first one answers to single pattern matching queries in time O(n(1/m+log sigma/w)+occ) while the second one answers to multiple pattern matching queries to O(n((log d+log y+log log d)/y+log sigma/w)+occ) where y is the length of the shortest pattern in the case of multiple pattern-matching. We then show how a simple application of the four russian technique permits to get data structures with query times independent of the length of the shortest pattern (the length of the only pattern in case of single string matching) at the expense of using more space.

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

↑