近乎最优的内部字典匹配
Nearly Optimal Internal Dictionary Matching
AI总结:
提出一种名为基本子串结构(BASS)的O(n)大小数据结构,用于内部字典匹配问题,在近乎最优的查询和预处理时间内处理所有查询类型,包括CountDistinct、Count和ReportDistinct查询的加速。
摘要:
我们研究内部字典匹配(IDM)问题,其中给定一个字典$\mathcal{D}$,包含文本$T$的$d$个子串,每个查询涉及$\mathcal{D}$中的模式在$T$的另一个子串中的出现。我们提出了一种新颖的$O(n)$大小的数据结构,名为基本子串结构(BASS),其中$n$是文本$T$的长度。利用BASS,我们能够在近乎最优的查询和预处理时间内处理IDM问题中的所有查询类型。具体来说,我们的结果包括:$\bullet$ 第一个在$\tilde{O}(1)$时间内回答CountDistinct查询的算法,预处理时间为$\tilde{O}(n+d)$,其中我们需要计算存在于$T[l,r]$中的不同模式的数量。此前,最佳结果是每次查询$\tilde{O}(m)$时间,预处理时间为$\tilde{O}(n^2/m+d)$或$\tilde{O}(nd/m+d)$,其中$m$是一个选择的参数。$\bullet$ 针对其他两种内部查询的更快算法。我们将(1)出现计数(Count)查询的运行时间改进为每次查询$O(\log n/\log\log n)$,预处理时间为$O(n+d\sqrt{\log n})$,而此前为每次查询$O(\log^2 n/\log\log n)$,预处理时间为$O(n\log n/\log \log n+d\log^{3/2} n)$。(2)不同模式报告(ReportDistinct)查询的运行时间改进为每次查询$O(1+|\text{output}|)$,而此前为每次查询$O(\log n+|\text{output}|)$。此外,我们在剩余两种查询类型——模式存在性(Exists)和出现报告(Report)——中达到了最优运行时间。我们还展示了BASS更普遍地适用于其他内部查询问题。
英文摘要:
We study the internal dictionary matching (IDM) problem where a dictionary $\mathcal{D}$ containing $d$ substrings of a text $T$ is given, and each query concerns the occurrences of patterns in $\mathcal{D}$ in another substring of $T$. We propose a novel $O(n)$-sized data structure named Basic Substring Structure (BASS) where $n$ is the length of the text $T.$ With BASS, we are able to handle all types of queries in the IDM problem in nearly optimal query and preprocessing time. Specifically, our results include: $\bullet$ The first algorithm that answers the CountDistinct query in $\tilde{O}(1)$ time with $\tilde{O}(n+d)$ preprocessing, where we need to compute the number of distinct patterns that exist in $T[l,r]$. Previously, the best result was $\tilde{O}(m)$ time per query after $\tilde{O}(n^2/m+d)$ or $\tilde{O}(nd/m+d)$ preprocessing, where $m$ is a chosen parameter. $\bullet$ Faster algorithms for two other types of internal queries. We improve the runtime for (1) Occurrence counting (Count) queries to $O(\log n/\log\log n)$ time per query with $O(n+d\sqrt{\log n})$ preprocessing from $O(\log^2 n/\log\log n)$ time per query with $O(n\log n/\log \log n+d\log^{3/2} n)$ preprocessing. (2) Distinct pattern reporting (ReportDistinct) queries to $O(1+|\text{output}|)$ time per query from $O(\log n+|\text{output}|)$ per query. In addition, we match the optimal runtime in the remaining two types of queries, pattern existence (Exists), and occurrence reporting (Report). We also show that BASS is more generally applicable to other internal query problems.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。