NIST

longest common subsequence

(classic problem)

Definition: The problem of finding a maximum length (or maximum weight) subsequence of two or more strings.

Also known as heaviest common subsequence.

See also Ratcliff/Obershelp pattern recognition, longest common substring, shortest common supersequence.

Note: The longest common substring is contiguous, while the longest common subsequence need not be.

From Algorithms and Theory of Computation Handbook, page 13-17, Copyright © 1999 by CRC Press LLC. Appearing in the Dictionary of Computer Science, Engineering and Technology, Copyright © 2000 CRC Press LLC.

Author: CRC-A

Implementation

(C and Mathematica)

More information

Dan Hirschberg's pseudocode as an example of dynamic programming. Longest-common subsequence problem in Wikipedia.


Go to the Dictionary of Algorithms and Data Structures home page.

If you have suggestions, corrections, or comments, please get in touch with Paul E. Black.

Entry modified 18 December 2006.
HTML page formatted Mon Dec 18 15:57:09 2006.

Cite this as:
Algorithms and Theory of Computation Handbook, CRC Press LLC, 1999, "longest common subsequence", in Dictionary of Algorithms and Data Structures [online], Paul E. Black, ed., U.S. National Institute of Standards and Technology. 18 December 2006. (accessed TODAY) Available from: http://www.nist.gov/dads/HTML/longestCommonSubsequence.html

to NIST home page