arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2501.00111cs.DS
收藏

二进制乱序索引:后缀树直方图

Binary Jumbled Indexing: Suffix tree histogram

Luís Cunha, Mário Medina

AI总结:

本文研究二进制乱序索引问题,证明游程数平均为 n/4 导致现有算法平均复杂度为二次方,并提出基于后缀树去重和向量化优化的 SFTree 算法,在保持相同理论复杂度下显著提升实际性能。

摘要:

给定一个字母表为 {0, 1} 的二进制字符串 ω,向量 (a, b) 是 Parikh 向量当且仅当 ω 的某个因子恰好包含 a 个 0 和 b 个 1。判断一个向量是否为 ω 的 Parikh 向量被称为二进制乱序索引问题(BJPMP)或直方图索引问题。该问题的大多数解决方案依赖于 O(n) 字空间索引以在常数时间内回答查询,编码 ω 的 Parikh 集合,即其所有 Parikh 向量。Cunha 等人(Combinatorial Pattern Matching, 2017)提出了一个算法(JBM2017),该算法在 O(n+ρ²) 时间内计算索引表,其中 ρ 是 ω 中相同数字的游程数,在最坏情况下达到 O(n²)。我们证明了游程数 ρ 的平均值为 n/4,从而确认了其在平均情况下也具有二次方行为。我们提出了一种新算法 SFTree,它使用后缀树来去除重复子串。尽管由于对游程边界的根本依赖,SFTree 的平均情况复杂度也为 Θ(n²),但它通过向量化最小化内存访问开销,实现了实际性能的提升。后缀树还使得不同子串能够被高效处理,降低了内存访问的有效成本。因此,虽然两种算法表现出相似的理论增长,SFTree 在实践中显著优于其他算法。我们的分析突出了 SFTree 方法在理论和实践上的优势,并具有扩展到后缀树其他应用的潜力。

英文摘要:

Given a binary string $ω$ over the alphabet $\{0, 1\}$, a vector $(a, b)$ is a Parikh vector if and only if a factor of $ω$ contains exactly $a$ occurrences of $0$ and $b$ occurrences of $1$. Answering whether a vector is a Parikh vector of $ω$ is known as the Binary Jumbled Indexing Problem (BJPMP) or the Histogram Indexing Problem. Most solutions to this problem rely on an $O(n)$ word-space index to answer queries in constant time, encoding the Parikh set of $ω$, i.e., all its Parikh vectors. Cunha et al. (Combinatorial Pattern Matching, 2017) introduced an algorithm (JBM2017), which computes the index table in $O(n+ρ^2)$ time, where $ρ$ is the number of runs of identical digits in $ω$, leading to $O(n^2)$ in the worst case. We prove that the average number of runs $ρ$ is $n/4$, confirming the quadratic behavior also in the average-case. We propose a new algorithm, SFTree, which uses a suffix tree to remove duplicate substrings. Although SFTree also has an average-case complexity of $Θ(n^2)$ due to the fundamental reliance on run boundaries, it achieves practical improvements by minimizing memory access overhead through vectorization. The suffix tree further allows distinct substrings to be processed efficiently, reducing the effective cost of memory access. As a result, while both algorithms exhibit similar theoretical growth, SFTree significantly outperforms others in practice. Our analysis highlights both the theoretical and practical benefits of the SFTree approach, with potential extensions to other applications of suffix trees.

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

↑