arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2303.07229cs.DS
收藏

一般字母表上的最优平方检测

Optimal Square Detection Over General Alphabets

Jonas Ellert, Paweł Gawrychowski, Garance Gourdel

摘要:

正方形(对于某些字符串$x$,形式为$xx$的片段)可以说是字符串中最自然的重复类型。关于平方的基本算法问题是检查给定长度为$n$的字符串是否是无平方的,也就是说,不包含这种形式的片段。Main和Lorentz [J. Algorithms 1984]为这个问题设计了一个$\mathcal{O}(n\log n)$时间算法,并证明了一个匹配的下界,假设所谓的通用字母表,这意味着该算法只允许检查两个字符是否相等。但是,它们的下限还假设字符串中存在$Ω(n)$不同的符号。作为一个开放性问题,他们问如果限制字母表的大小,是否有更快的算法。克劳什莫尔(Theor)Comput. Sci. 1986年]设计了一个线性时间算法恒定大小的字母表,并结合最近的结果,他的方法实际上意味着这样的算法线性排序的字母表。最近,Ellert和Fischer [ICALP 2021]通过为一般有序字母表设计线性时间算法,即假设字符的线性顺序允许恒定的时间顺序比较,大大放松了这一假设。然而,1984年Main和Lorentz的公开问题对于一般(无序)字母表仍然没有解决。在本文中,我们表明,测试平方自由的长度$n$字符串的大小PDMATHAMR一般字母表可以做$\mathcal{O}(n\log σ)$比较,不能做$o(n\log σ)$比较。我们补充这个结果与$\mathcal{O}(n\log σ)$时间算法在字RAM模型。最后,我们将算法扩展到以相同的复杂度报告所有运行(最大重复)。

英文摘要:

Squares (fragments of the form $xx$, for some string $x$) are arguably the most natural type of repetition in strings. The basic algorithmic question concerning squares is to check if a given string of length $n$ is square-free, that is, does not contain a fragment of such form. Main and Lorentz [J. Algorithms 1984] designed an $\mathcal{O}(n\log n)$ time algorithm for this problem, and proved a matching lower bound assuming the so-called general alphabet, meaning that the algorithm is only allowed to check if two characters are equal. However, their lower bound also assumes that there are $Ω(n)$ distinct symbols in the string. As an open question, they asked if there is a faster algorithm if one restricts the size of the alphabet. Crochemore [Theor. Comput. Sci. 1986] designed a linear-time algorithm for constant-size alphabets, and combined with more recent results his approach in fact implies such an algorithm for linearly-sortable alphabets. Very recently, Ellert and Fischer [ICALP 2021] significantly relaxed this assumption by designing a linear-time algorithm for general ordered alphabets, that is, assuming a linear order on the characters that permits constant time order comparisons. However, the open question of Main and Lorentz from 1984 remained unresolved for general (unordered) alphabets. In this paper, we show that testing square-freeness of a length-$n$ string over general alphabet of size $σ$ can be done with $\mathcal{O}(n\log σ)$ comparisons, and cannot be done with $o(n\log σ)$ comparisons. We complement this result with an $\mathcal{O}(n\log σ)$ time algorithm in the Word RAM model. Finally, we extend the algorithm to reporting all the runs (maximal repetitions) in the same complexity.

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

↑