The Longest Common Bitonic Subsequence: A Match-Sensitive Dynamic Programming Approach

Abstract

Given two sequences A[1..n] and B[1..m] over a totally ordered alphabet, the Longest Common Bitonic Subsequence (LCBS) problem asks for a longest common subsequence that is strictly increasing up to a single peak element and strictly decreasing thereafter (allowing either phase to be empty). The only explicitly documented approach evaluates a quadratic dynamic program over the full n× m grid, which is prohibitive on large inputs. We present two exact algorithms. First, we give a simple (nm)-time baseline that computes LCBS by combining a longest common increasing subsequence (LCIS) computation on (A,B) with a second LCIS computation on the reversed inputs, and then maximizing INC(i,j)+DEC(i,j)-1 over all common peaks. The method is constructive via parent pointers. Second, we develop an instance-sensitive algorithm whose running time depends on the number M of matching pairs (i,j) with A[i]=B[j]. We view matches as vertices of a dominance-ordered poset and compute the increasing and decreasing halves by two 2D dominance DP passes supported by orthogonal range-maximum data structures, followed by a linear peak scan. With a standard 2D range tree (or equivalent), this yields O(M2M + M + (n+m)(n+m)) time and O(M M) space, and it improves over the dense baseline whenever M2 M nm.

0

Turn this paper into a full lesson

ArcXiv compiles a staged curriculum from this paper: 8-12 lessons across beginner → advanced, synthesised section guides, visuals, flashcards, a quiz, exercises, and on-demand deep dives per section. Grounded in the abstract, never invented.

Discussion (0)

Sign in to join the discussion.

Loading comments…