Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Longest common subsequence
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Algorithmic problem on pairs of sequences}} {{Distinguish|longest common substring}} [[File:Nubio Diff Screenshot3.png|thumb|Comparison of two revisions of an example file, based on their longest common subsequence (black)]] A '''longest common subsequence''' ('''LCS''') is the longest [[subsequence]] common to all sequences in a set of sequences (often just two sequences). It differs from the [[longest common substring]]: unlike substrings, subsequences are not required to occupy consecutive positions within the original sequences. The problem of computing longest common subsequences is a classic [[computer science]] problem, the basis of [[data comparison]] programs such as the [[diff utility|<code>diff</code> utility]], and has applications in [[computational linguistics]] and [[bioinformatics]]. It is also widely used by [[Revision control|revision control systems]] such as [[Git (software)|Git]] for [[Merge (revision control)|reconciling]] multiple changes made to a revision-controlled collection of files. <!-- todo: add definition and example --> For example, consider the sequences (ABCD) and (ACBAD). They have five length-2 common subsequences: (AB), (AC), (AD), (BD), and (CD); two length-3 common subsequences: (ABD) and (ACD); and no longer common subsequences. So (ABD) and (ACD) are their longest common subsequences.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)