mirror of
https://github.com/trekhleb/javascript-algorithms.git
synced 2025-12-08 19:06:00 +00:00
* Fixed typo in the word 'independant' * Fixed typo in the word 'subsequnce' * Fixed typo in the word 'icecream' * Fixed typo in the word 'subsequnce' in shortestCommonSubsequence * Fixed typo in the word 'depected' * Fixed typo in the word 'paramaters'
26 lines
1.0 KiB
Markdown
26 lines
1.0 KiB
Markdown
# Longest common subsequence problem
|
|
|
|
The longest common subsequence (LCS) problem is the problem of finding
|
|
the longest subsequence common to all sequences in a set of sequences
|
|
(often just two sequences). It differs from the longest common substring
|
|
problem: unlike substrings, subsequences are not required to occupy
|
|
consecutive positions within the original sequences.
|
|
|
|
## Application
|
|
|
|
The longest common subsequence problem is a classic computer science
|
|
problem, the basis of data comparison programs such as the diff utility,
|
|
and has applications in bioinformatics. It is also widely used by
|
|
revision control systems such as Git for reconciling multiple changes
|
|
made to a revision-controlled collection of files.
|
|
|
|
## Example
|
|
|
|
- LCS for input Sequences `ABCDGH` and `AEDFHR` is `ADH` of length 3.
|
|
- LCS for input Sequences `AGGTAB` and `GXTXAYB` is `GTAB` of length 4.
|
|
|
|
## References
|
|
|
|
- [Wikipedia](https://en.wikipedia.org/wiki/Longest_common_subsequence_problem)
|
|
- [YouTube](https://www.youtube.com/watch?v=NnD96abizww&list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8)
|