Space-Efficient and Output-Sensitive Algorithms for the Longest Common Bitonic Subsequence
Md. Tanzeem Rahat, Md. Manzurul Hasan
TL;DR
LCBS seeks the longest subsequence common to two sequences that is bitonic. The paper presents two complementary exact solvers: a linear-space refinement of the classic $Θ(nm)$-time DP implemented with rolling rows, and an output-sensitive sparse-DAG approach that builds a compact DAG from matching pairs and computes the optimum via two 2-D range-tree passes, achieving $O((n+m)\log n + M\log^2 M)$ time and $O(M)$ space where $M$ is the number of matches. A streaming, Hirschberg-like variant further reduces space to $Θ(m)$ while preserving $Θ(nm)$ time. Together, these results show that exact LCBS computation can be practical on larger inputs and establish a fine-grained complexity landscape that motivates instance-sensitive preprocessing and future exploration.
Abstract
The longest common bitonic subsequence (LCBS) of two sequences A and B is the longest subsequence that increases to a single peak and then decreases while appearing, in order, in both inputs. Although LCBS naturally models rise-fall patterns in bioinformatics, finance, and signal analysis, the only previously documented solution was a quadratic dynamic program that needs θ(nm) time and space. We show that this space barrier is not inherent: a refined rolling-row implementation evaluates the same recurrence in θ(nm) time with only θ(min(n, m)) additional memory. By isolating the M symbol matches and their C bitonic-compatible pairs, we cast LCBS as a longest-path problem in a sparse DAG and solve it in O((n + m) log n + M log M) time and O(M) space, which is asymptotically faster than the quadratic baseline whenever M << n m. These results make exact LCBS computation practical for inputs that were previously out of reach and expose a new fine-grained complexity landscape that invites further exploration.
