[Paper Review] On Longest Repeat Queries
This paper introduces an optimal O(n) time and space algorithm for computing the leftmost longest repeat (LR) covering every non-singleton position in a string, using a novel two-table system to efficiently answer 'stabbing' queries for repeats. The method leverages suffix arrays, rank arrays, and LCP arrays to enable linear-time processing of all longest repeat queries, providing a powerful tool for computational biology and string analysis applications.
Repeat finding in strings has important applications in subfields such as computational biology. Surprisingly, all prior work on repeat finding did not consider the constraint on the locality of repeats. In this paper, we propose and study the problem of finding longest repetitive substrings covering particular string positions. We propose an $O(n)$ time and space algorithm for finding the longest repeat covering every position of a string of size $n$. Our work is optimal since the reading and the storage of an input string of size $n$ takes $O(n)$ time and space. Because any substring of a repeat is also a repeat, our solution to longest repeat queries effectively provides a "stabbing" tool for practitioners for finding most of the repeats that cover particular string positions.
Motivation & Objective
- To address the gap in prior work by introducing a locality-aware repeat finding problem, focusing on repeats covering specific string positions.
- To design an efficient algorithm that computes the leftmost longest repeat (LR) for every non-singleton string position.
- To achieve optimal O(n) time and space complexity, matching the input reading and storage cost.
- To provide a practical 'stabbing' tool for biologists and data scientists to discover all repeats covering a given genomic or string position.
Proposed method
- Constructs the suffix array (SA), rank array (Rank), and LCP array from the input string in O(n) time using known linear-time algorithms.
- Computes the left-bounded longest repeat (LLR) for each position i using Lemma 2.1: LLRi = S[i...i + Li −1] where Li = max{LCP[Rank[i]], LCP[Rank[i]+1]} if Li > 0.
- Sorts the LLR array in descending order of length using a stable, linear-time counting sort.
- Employs a two-table system (ptr and next arrays) to maintain intervals of positions covered by each LLR, enabling efficient range queries and updates.
- Processes each LLR in sorted order, propagating the leftmost LR to all positions in its interval using the two-table system, with early termination when all positions are covered.
- Uses a single pass with O(1) updates per element to maintain the two-table system, ensuring total O(n) time complexity.
Experimental results
Research questions
- RQ1Can we efficiently compute the longest repeat covering each specific string position, beyond just maximal or super-maximal repeats?
- RQ2Is it possible to design a linear-time and space algorithm for this localized longest repeat query problem?
- RQ3Can we provide a practical data structure that supports 'stabbing' queries for all repeats covering a given position?
- RQ4How can we leverage suffix arrays and LCP arrays to achieve optimal performance for this new query type?
- RQ5What is the minimal data structure overhead needed to support efficient range propagation of longest repeats?
Key findings
- The proposed algorithm computes the leftmost longest repeat for every non-singleton string position in O(n) time and space, achieving optimal complexity.
- The two-table system enables efficient interval management and propagation of repeat information with O(1) amortized cost per update.
- The algorithm correctly identifies all positions covered by the longest repeat, even when multiple overlapping repeats exist at a given position.
- The use of stable, linear-time sorting ensures correctness and efficiency in processing LLR intervals by length.
- The method supports practical 'stabbing' queries—finding all repeats covering a given position—by effectively computing the leftmost LR for each position.
- The implementation is based on standard string data structures (SA, Rank, LCP), making it compatible with existing bioinformatics pipelines and efficient to deploy.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.