AI 中文总结
提出在线后缀树与link-cut树结合的数据结构LCST,实现在线计算字符串中所有最大封闭子串,总时间O(n log n),空间O(n)。
AI 中文摘要
一个非空字符串如果是封闭的,则其长度为一或其最长边界在字符串中恰好出现两次。封闭子串的出现称为最大封闭子串(MCS),如果它不能向左或向右扩展而保持封闭性。MCS可视为包括run在内的一类最大重复结构的一般类别。本文研究以在线方式计算字符串的MCS,其中每次向字符串追加一个字符。我们的算法通过使用后缀的最右先前出现来检测每次追加操作后新形成的MCS。为了高效支持这一点,我们引入了link-cut后缀树(LCST),这是一种结合在线后缀树和link-cut树的新型数据结构。LCST在后缀树中维护子串的最右出现信息,总时间为$O(n \log n)$,空间为$O(n)$,其中$n$是输入字符串的长度。使用LCST,我们获得了计算所有MCS的$O(n \log n)$时间在线算法,这是最坏情况最优的。作为LCST的进一步直接应用,我们获得了最右LZ77分解和最近匹配查询的在线算法。
英文摘要
A non-empty string is closed if it has length one or its longest border appears exactly twice in the string. An occurrence of a closed substring is a maximal closed substring (MCS) if it cannot be extended to the left or to the right while preserving closedness. MCSs can be regarded as a general class of maximal repetitive structures including runs. In this paper, we study the computation of MCSs of a string given in an online manner, where one character is appended to the string at a time. Our algorithm detects newly formed MCSs after each append operation by using the rightmost previous occurrence of each suffix. To support this efficiently, we introduce the link-cut suffix tree (LCST), a novel data structure combining an online suffix tree with a link-cut tree. The LCST maintains rightmost occurrence information for substrings represented in the suffix tree in $O(n \log n)$ total time and $O(n)$ space, where $n$ is the length of the input string. Using the LCST, we obtain an $O(n \log n)$-time online algorithm for computing all MCSs, which is worst-case optimal. As further direct applications of the LCST, we obtain online algorithms for rightmost LZ77 factorizations and most recent match queries.