Constrained LCS: Hardness and approximation

Zvi Gotthilf, Danny Hermelin, Moshe Lewenstein

Research output: Chapter in Book/Report/Conference proceedingConference contributionpeer-review

34 Scopus citations


The problem of finding the longest common subsequence (LCS) of two given strings A 1 and A 2 is a well-studied problem. The constrained longest common subsequence (C-LCS) for three strings A 1, A 2 and B 1 is the longest common subsequence of A 1 and A 2 that contains B 1 as a subsequence. The fastest algorithm solving the C-LCS problem has a time complexity of O(m 1 m 2 n 1) where m 1, m 2 and n 1 are the lengths of A 1, A 2 and B 1 respectively. In this paper we consider two general variants of the C-LCS problem. First we show that in case of two input strings and an arbitrary number of constraint strings, it is NP-hard to approximate the C-LCS problem. Moreover, it is easy to see that in case of an arbitrary number of input strings and a single constraint, the problem of finding the constrained longest common subsequence is NP-hard. Therefore, we propose a linear time approximation algorithm for this variant, our algorithm yields a 1/ √m min|∑| approximation factor, where mmin is the length of the shortest input string and |∑| is the size of the alphabet.

Original languageEnglish
Title of host publicationCombinatorial Pattern Matching - 19th Annual Symposium, CPM 2008, Proceedings
Number of pages8
StatePublished - 1 Jul 2008
Externally publishedYes
Event19th Annual Symposium on Combinatorial Pattern Matching, CPM 2008 - Pisa, Italy
Duration: 18 Jun 200820 Jun 2008

Publication series

NameLecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)
Volume5029 LNCS
ISSN (Print)0302-9743
ISSN (Electronic)1611-3349


Conference19th Annual Symposium on Combinatorial Pattern Matching, CPM 2008

ASJC Scopus subject areas

  • Theoretical Computer Science
  • General Computer Science


Dive into the research topics of 'Constrained LCS: Hardness and approximation'. Together they form a unique fingerprint.

Cite this