内部字典匹配中不同模式的计数
Counting Distinct Patterns in Internal Dictionary Matching
摘要:
我们认为,为了能够有效地回答查询$CountDistinct(i,j)$,也就是说,给定$i$和$j$从$\mathcal{D}$中返回的模式的数量发生在片段$T[i \mathinner{.\,.} j]$的文本$T$的长度$n$和字典$\mathcal{D}$预处理的问题。字典是内部的,因为$\mathcal{D}$中的每个模式都是作为$T$的一个片段给出的。这样,字典占用的空间与模式的数量成正比,而不是与模式的总长度成正比,模式的总长度可以是$Θ(n\cdot d)$,$d=|\mathcal{D}|$。最近在一项引入内部字典匹配的工作中提出了一种$\tilde{\mathcal{O}}(n+d)$大小的数据结构,该结构大约在$\tilde{\mathcal{O}}(1)$时间内回答$CountDistinct(i,j)$查询$\mathcal{O}(\log n)$ [ISAAC 2019]。在这里,我们提出了一个$\tilde{\mathcal{O}}(n+d)$大小的数据结构,回答$CountDistinct(i,j)$查询$2$ -大约在$\tilde{\mathcal{O}}(1)$的时间。使用范围查询,对于任何$m$,我们给出了一个$\tilde{\mathcal{O}}(\min(nd/m,n^2/m^2)+d)$大小的数据结构,在$\tilde{\mathcal{O}}(m)$时间内准确地回答$CountDistinct(i,j)$查询。我们还考虑了字典由字符串的所有平方因子组成的特殊情况。我们设计了一个$\mathcal{O}(n \log^2 n)$大小的数据结构,使我们能够在$\mathcal{O}(\log n)$时间内计算文本片段$T[i \mathinner{.\,.} j]$中的不同方块。
英文摘要:
We consider the problem of preprocessing a text $T$ of length $n$ and a dictionary $\mathcal{D}$ in order to be able to efficiently answer queries $CountDistinct(i,j)$, that is, given $i$ and $j$ return the number of patterns from $\mathcal{D}$ that occur in the fragment $T[i \mathinner{.\,.} j]$. The dictionary is internal in the sense that each pattern in $\mathcal{D}$ is given as a fragment of $T$. This way, the dictionary takes space proportional to the number of patterns $d=|\mathcal{D}|$ rather than their total length, which could be $Θ(n\cdot d)$. An $\tilde{\mathcal{O}}(n+d)$-size data structure that answers $CountDistinct(i,j)$ queries $\mathcal{O}(\log n)$-approximately in $\tilde{\mathcal{O}}(1)$ time was recently proposed in a work that introduced internal dictionary matching [ISAAC 2019]. Here we present an $\tilde{\mathcal{O}}(n+d)$-size data structure that answers $CountDistinct(i,j)$ queries $2$-approximately in $\tilde{\mathcal{O}}(1)$ time. Using range queries, for any $m$, we give an $\tilde{\mathcal{O}}(\min(nd/m,n^2/m^2)+d)$-size data structure that answers $CountDistinct(i,j)$ queries exactly in $\tilde{\mathcal{O}}(m)$ time. We also consider the special case when the dictionary consists of all square factors of the string. We design an $\mathcal{O}(n \log^2 n)$-size data structure that allows us to count distinct squares in a text fragment $T[i \mathinner{.\,.} j]$ in $\mathcal{O}(\log n)$ time.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。