Table of Contents
Fetching ...

A Space-Efficient Algorithm for Longest Common Almost Increasing Subsequence of Two Sequences

Md Tanzeem Rahat, Md. Manzurul Hasan, Debajyoti Mondal

TL;DR

The paper tackles finding the longest common almost increasing subsequence (LCaIS) of two sequences with a fixed δ, offering a space-efficient Hirschberg-inspired solution that runs in $O(nm\ell)$ time and uses $O(n+m\ell)$ space, where $\ell$ is the LCaIS length. It also presents an output-dependent algorithm that accelerates computation when the number of matching and compatible pairs, $\mathcal{M}$ and $\mathcal{C}$, are small, achieving $O((n+m)\log n + \mathcal{M}\log \mathcal{M} + \mathcal{C}\ell)$ time and $O(\mathcal{M}(\ell+\log \mathcal{M}))$ space. The first approach adapts Hirschberg's divide-and-conquer technique to the LCaIS setting, using DP-like states $P'[j,r]$ and $Q'[j,r]$ to constrain the solution by the largest element, while the second approach models the problem as a specialized DAG over matching pairs and leverages a range-tree to prune the search space. Together, these results improve space consumption relative to prior $O(nm)$-space methods and offer faster performance in favorable input regimes, with clear avenues for further subquadratic improvements and bit-vector optimizations when $\ell$ is small.

Abstract

Let $A$ and $B$ be two number sequences of length $n$ and $m$, respectively, where $m\le n$. Given a positive number $δ$, a common almost increasing sequence $s_1\ldots s_k$ is a common subsequence for both $A$ and $B$ such that for all $2\le i\le k$, $s_i+δ> \max_{1\le j < i} s_j$. The LCaIS problem seeks to find the longest common almost increasing subsequence (LCaIS) of $A$ and $B$. An LCaIS can be computed in $O(nm\ell)$ time and $O(nm)$ space [Ta, Shieh, Lu (TCS 2021)], where $\ell$ is the length of the LCaIS of $A$ and $B$. In this paper we first give an $O(nm\ell)$-time and $O(n+m\ell)$-space algorithm to find LCaIS, which improves the space complexity. We then design an $O((n+m)\log n +\mathcal{M}\log \mathcal{M} + \mathcal{C}\ell)$-time and $O(\mathcal{M}(\ell+\log \mathcal{M}))$-space algorithm, which is faster when the number of matching pairs $\mathcal{M}$ and the number of compatible matching pairs $\mathcal{C}$ are in $o(nm/\log m)$.

A Space-Efficient Algorithm for Longest Common Almost Increasing Subsequence of Two Sequences

TL;DR

The paper tackles finding the longest common almost increasing subsequence (LCaIS) of two sequences with a fixed δ, offering a space-efficient Hirschberg-inspired solution that runs in time and uses space, where is the LCaIS length. It also presents an output-dependent algorithm that accelerates computation when the number of matching and compatible pairs, and , are small, achieving time and space. The first approach adapts Hirschberg's divide-and-conquer technique to the LCaIS setting, using DP-like states and to constrain the solution by the largest element, while the second approach models the problem as a specialized DAG over matching pairs and leverages a range-tree to prune the search space. Together, these results improve space consumption relative to prior -space methods and offer faster performance in favorable input regimes, with clear avenues for further subquadratic improvements and bit-vector optimizations when is small.

Abstract

Let and be two number sequences of length and , respectively, where . Given a positive number , a common almost increasing sequence is a common subsequence for both and such that for all , . The LCaIS problem seeks to find the longest common almost increasing subsequence (LCaIS) of and . An LCaIS can be computed in time and space [Ta, Shieh, Lu (TCS 2021)], where is the length of the LCaIS of and . In this paper we first give an -time and -space algorithm to find LCaIS, which improves the space complexity. We then design an -time and -space algorithm, which is faster when the number of matching pairs and the number of compatible matching pairs are in .

Paper Structure

This paper contains 9 sections, 4 theorems, 4 equations, 1 figure, 1 table, 4 algorithms.

Key Result

Lemma 3.1

Let $\mathcal{P}'(i,j,r)$ be True if there exists an LCaIS for $A[1\ldots i]$ and $B[1\ldots m]$ of length $r$ ending with $B[j]$. For $r>0$, if $\mathcal{P}'(i,j,r)$ is True, then let $\mathcal{Q}'(i,j,r)$ denote the smallest number such that there exists an LCaIS ending with $B[j]$ of length $r$ s

Figures (1)

  • Figure 1: Illustration for the computation of LCaIS length.

Theorems & Definitions (7)

  • Lemma 3.1
  • proof
  • Lemma 3.2
  • proof
  • Theorem 3.3
  • Theorem 4.1
  • proof