The fundamental question considered in algorithms on strings is that of indexing, that is, preprocessing a given string for specific queries. By now we have a number of efficient solutions for this problem when the queries ask for an exact occurrence of a given pattern $P$. However, practical applications motivate the necessity of considering more complex queries, for example concerning near occurrences of two patterns. Recently, Bille et al. [CPM 2021] introduced a variant of such queries, called gapped consecutive occurrences, in which a query consists of two patterns $P_{1}$ and $P_{2}$ and a range $[a,b]$, and one must find all consecutive occurrences $(q_1,q_2)$ of $P_{1}$ and $P_{2}$ such that $q_2-q_1 \in [a,b]$. By their results, we cannot hope for a very efficient indexing structure for such queries, even if $a=0$ is fixed (although at the same time they provided a non-trivial upper bound). Motivated by this, we focus on a text given as a straight-line program (SLP) and design an index taking space polynomial in the size of the grammar that answers such queries in time optimal up to polylog factors.
翻译:字符串算法中考虑的基本问题是指索引,即对给定字符串进行预处理以支持特定查询。目前,当查询要求给定模式$P$的精确出现时,我们已有多种高效解决方案。然而,实际应用推动了考虑更复杂查询的必要性,例如涉及两个模式的近似出现。最近,Bille等人[CPM 2021]引入了一种此类查询的变体,称为带间隔的连续出现,其中查询由两个模式$P_{1}$和$P_{2}$以及一个区间$[a,b]$组成,需找出所有满足$q_2-q_1 \in [a,b]$的$P_{1}$和$P_{2}$的连续出现$(q_1,q_2)$。根据他们的结果,即便固定$a=0$,此类查询也难以期待非常高效的索引结构(尽管他们同时给出了一个非平凡的上界)。受此启发,我们聚焦于以直线程序(SLP)表示的文本,设计了一个索引,其空间复杂度与文法规模呈多项式关系,能够在对数因子范围内以最优时间回答此类查询。