[Paper Review] An In-place Framework for Exact and Approximate Shortest Unique Substring Queries
This paper presents an in-place framework for computing both exact and approximate (k-mismatch) shortest unique substrings (SUS) for every position in a string. It achieves O(n) time for exact SUS and O(n²) for approximate SUS using only 2n words plus n bytes, making it space-efficient and practical without compressed data structures.
We revisit the exact shortest unique substring (SUS) finding problem, and propose its approximate version where mismatches are allowed, due to its applications in subfields such as computational biology. We design a generic in-place framework that fits to solve both the exact and approximate $k$-mismatch SUS finding, using the minimum $2n$ memory words plus $n$ bytes space, where $n$ is the input string size. By using the in-place framework, we can find the exact and approximate $k$-mismatch SUS for every string position using a total of $O(n)$ and $O(n^2)$ time, respectively, regardless of the value of $k$. Our framework does not involve any compressed or succinct data structures and thus is practical and easy to implement.
Motivation & Objective
- To address the need for efficient computation of shortest unique substrings (SUS) in applications like bioinformatics and document search.
- To extend the exact SUS problem to its approximate version allowing k mismatches, enhancing applicability in genetic sequence analysis.
- To design a practical in-place algorithm that uses minimal memory—2n words plus n bytes—without relying on compressed or succinct data structures.
- To achieve optimal time complexity: O(n) for exact SUS and O(n²) for approximate k-mismatch SUS, independent of k.
- To provide a framework that is easy to implement and suitable for real-world string processing tasks.
Proposed method
- The framework uses two auxiliary arrays A and B, initially storing leftmost SUS (LSUS) and their end positions, respectively.
- It performs a right-to-left scan of array B to compute the rightmost leftmost SUS (SLSUS) for each position, overwriting B with the end positions of SLSUS.
- Then, it computes the final SUS for each position i in a left-to-right pass, using dynamic updates based on the previous SUS and the current SLSUS.
- For each position i, if SLSUS exists and is shorter than the extended previous SUS, it is chosen; otherwise, the previous SUS is extended by S[i].
- The algorithm ensures correctness by leveraging properties of k-mismatch uniqueness and substring coverage, using only in-place array modifications.
- The framework avoids any compressed data structures and operates directly on the input string and two integer arrays, minimizing space and memory access.
Experimental results
Research questions
- RQ1Can an in-place algorithm efficiently compute exact and approximate (k-mismatch) shortest unique substrings for all string positions?
- RQ2What is the minimal space requirement for solving the k-mismatch SUS problem while maintaining practicality and correctness?
- RQ3How can the time complexity be kept independent of k for the approximate SUS case?
- RQ4Is it possible to design a framework that avoids compressed data structures yet achieves optimal time and space efficiency?
- RQ5Can the same algorithmic structure be reused for both exact and approximate SUS computation with minimal modifications?
Key findings
- The proposed in-place framework uses only 2n words plus n bytes, which is the minimum space required to store n SUSes and the original string.
- For exact SUS (k=0), the algorithm runs in O(n) time, significantly improving upon prior O(n²) solutions.
- For approximate k-mismatch SUS with k≥1, the algorithm runs in O(n²) time, independent of the value of k.
- The framework does not rely on compressed or succinct data structures, making it practical and easy to implement.
- The algorithm correctly computes the rightmost SUS for each position by dynamically maintaining and updating start and end positions in arrays A and B.
- The solution is generic and can be adapted to find either the leftmost or rightmost SUS by minor modifications to the tie-breaking rule.
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.