Binary Jumbled Indexing: Suffix tree histogram
Abstract
Given a binary string over the alphabet , a vector is a Parikh vector if and only if a factor of contains exactly occurrences of and occurrences of . 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 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 time, where is the number of runs of identical digits in , leading to in the worst case. We prove that the average number of runs is , 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 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.
Cite
@article{arxiv.2501.00111,
title = {Binary Jumbled Indexing: Suffix tree histogram},
author = {Luís Cunha and Mário Medina},
journal= {arXiv preprint arXiv:2501.00111},
year = {2025}
}
Comments
An extended abstract of this work was presented in COCOON 2024