English

Computing and Enumerating Minimal Common Supersequences Between Two Strings

Data Structures and Algorithms 2026-03-25 v1

Abstract

Given kk strings each of length at most nn, computing the shortest common supersequence of them is a well-known NP-hard problem (when kk is unbounded). On the other hand, when k=2k=2, such a shortest common supersequence can be computed in O(n2)O(n^2) time using dynamic programming as a textbook example. In this paper, we consider the problem of computing a \emph{minimal} common supersequence and enumerating all minimal common supersequences for k=2k=2 input strings. Our results are summarized as follows. A minimal common supersequence of k=2k=2 input strings can be computed in O(n)O(n) time. (The method also works when kk is a constant). All minimal common supersequences between two input strings can be enumerated with a data structure of O(n2)O(n^2) space and an O(n)O(n) time delay, and the data structure can be constructed in O(n3)O(n^3) time.

Keywords

Cite

@article{arxiv.2603.22591,
  title  = {Computing and Enumerating Minimal Common Supersequences Between Two Strings},
  author = {Braeden Sopp and Adiesha Liyanage and Mingyang Gong and Binhai Zhu},
  journal= {arXiv preprint arXiv:2603.22591},
  year   = {2026}
}

Comments

22 pages, 2 figures, 2 algorithms