Abstract
This paper introduces a breakthrough in string algorithms: a simple, sublinear-time algorithm for the "gap edit distance" problem. By leveraging a clever application of the birthday paradox and randomized hashing, the authors provide a method to distinguish between strings that are very similar (edit distance $\le k$) and those that are very different (edit distance $> k^2$) in $\tilde{O}(n/\sqrt{k})$ time. This result fills a significant gap in existing literature, offering the first "truly sublinear" algorithm across the entire range of relevant values for $k$.
Introduction
Edit distance, or Levenshtein distance, is a fundamental metric in bioinformatics and natural language processing, measuring the minimum number of edits required to transform one string into another. While essential, its exact computation is computationally expensive; the standard dynamic programming approach requires $O(n^2)$ time, which is impractical for large-scale genomic data.
To address this, researchers often turn to the Gap Edit Distance problem. Given a parameter $k$, the goal is to distinguish whether the distance between two strings is small ($\le k$) or large ($\ge k^2$). Previous algorithms achieved sublinear performance only in specific regimes, leaving a notable gap around $k \approx n^{1/3}$ where no sublinear solution was known. This work provides a unified, simple algorithm that bridges this gap.
Methodology
The proposed algorithm relies on a greedy matching framework supported by randomized hashing and a novel application of the birthday paradox.
The GreedyMatch Framework
The core logic is encapsulated in the GreedyMatch procedure. The algorithm maintains a pointer in one string and iteratively attempts to find the longest possible match in the other string within a defined window. If the end of the string can be reached within approximately $2k$ steps, the strings are classified as similar.
Subsampling and Hashing
To achieve sublinear time, the algorithm avoids reading every character. Instead, it subsamples roughly $1/k$ of the indices and computes Rabin-Karp rolling hashes for these positions. This allows for efficient comparisons without the overhead of full string scans.
Alignment via the Birthday Paradox
The primary challenge in sublinear edit distance is maintaining alignment; a single deletion can shift the entire string, causing hash mismatches. Traditionally, one might need to check $O(k)$ possible shifts to find the correct alignment. The authors overcome this by using the birthday paradox: by checking only $O(\sqrt{k})$ random shifts for each string, they demonstrate that at least one pair of shifts will collide and correctly align the strings with high probability. This reduces the complexity from $O(n)$ to $\tilde{O}(n/\sqrt{k})$.
Key Results
The paper establishes several significant theoretical bounds:
- Main Complexity: The algorithm solves the $k$-vs-$k^2$ gap edit distance problem in $\tilde{O}(n/\sqrt{k})$ time, making it truly sublinear for any $k > 1$.
- One-Sided Preprocessing: In scenarios where one string (e.g., a reference genome) can be preprocessed in $\tilde{O}(n)$ time, subsequent queries can be answered in $\tilde{O}(n/k)$ time. This is a substantial improvement over the previous state-of-the-art query time of $\tilde{O}(n/k + k^2)$.
- Flexibility: The framework allows for trade-offs between running time and approximation factors, such as distinguishing between $k$ and $k\ell$ distances.
Discussion and Future Work
While the algorithm provides a significant theoretical advancement, it currently distinguishes between $k$ and $k^2$. While standard in theoretical computer science, a $k^2$ gap may be too wide for certain practical applications. Furthermore, as a randomized algorithm, there remains a small (though controllable) probability of failure.
Future research may focus on narrowing this gap—perhaps to $k$ vs $k^{1+\epsilon}$—while maintaining sublinear efficiency. Additionally, exploring the application of these birthday-paradox-based alignment techniques to other metrics, such as Fréchet distance, remains a promising avenue for further study.
Summary updated