论文标题
在线性时间计算三位生中的allindromes
Computing palindromes on a trie in linear time
论文作者
论文摘要
trie $ \ nathcal {t} $是一棵根树,因此每个边缘都由字母内的单个字符标记,并且来自同一节点的外观边缘的标签相互不同。给定带有$ n $边缘的Trie $ \ Mathcal {t} $,我们展示了如何在$ o(n)$ o(n)$时间上计算$ \ Mathcal {t} $上的所有不同的palindromes和所有最大alindromes,在$ n $ n $ n $ n $ n $ n $ n $ n $ n $的整数字母中。这改善了Funakoshi等人的最新$ O(N \ log H)$ - 时间算法。 [PCS 2019],其中$ h $是$ \ Mathcal {t} $的高度。使用我们的新算法,具有给定Trie $ \ Mathcal {t} $的带有后缀链接的eertree可以在$ O(n)$时间中很容易获得。此外,我们基于TRIE的$ O(n)$ - 空间数据结构使我们能够在输出最佳时间中在Trie $ \ Mathcal {T} $中表示的查询字符串中报告所有不同的plindromes和最大plindromes。这是对现有(幼稚的)解决方案的改进,该解决方案预先计算和存储所有不同的pelindromes和最大的pelindromes,并使用Trie $ \ Mathcal {T} $中的每个字符串分别使用总$ O(N^2)$ o(n^2)$预处理时间和空间,并在查询询问的输出时间中报告它们。
A trie $\mathcal{T}$ is a rooted tree such that each edge is labeled by a single character from the alphabet, and the labels of out-going edges from the same node are mutually distinct. Given a trie $\mathcal{T}$ with $n$ edges, we show how to compute all distinct palindromes and all maximal palindromes on $\mathcal{T}$ in $O(n)$ time, in the case of integer alphabets of size polynomial in $n$. This improves the state-of-the-art $O(n \log h)$-time algorithms by Funakoshi et al. [PCS 2019], where $h$ is the height of $\mathcal{T}$. Using our new algorithms, the eertree with suffix links for a given trie $\mathcal{T}$ can readily be obtained in $O(n)$ time. Further, our trie-based $O(n)$-space data structure allows us to report all distinct palindromes and maximal palindromes in a query string represented in the trie $\mathcal{T}$, in output optimal time. This is an improvement over an existing (naïve) solution that precomputes and stores all distinct palindromes and maximal palindromes for each and every string in the trie $\mathcal{T}$ separately, using a total $O(n^2)$ preprocessing time and space, and reports them in output optimal time upon query.