Subsequence
This article includes a list of references, related reading or external links, but its sources remain unclear because it lacks inline citations.November 2018) (Learn how and when to remove this template message) ( |
In mathematics, a subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements. For example, the sequence ⟨A,B,D⟩{displaystyle langle A,B,Drangle } is a subsequence of ⟨A,B,C,D,E,F⟩{displaystyle langle A,B,C,D,E,Frangle } obtained after removal of elements C{displaystyle C}, E{displaystyle E}, and F{displaystyle F}. The relation of one sequence being the subsequence of another is a preorder.
The subsequence should not be confused with substring ⟨A,B,C,D⟩{displaystyle langle A,B,C,Drangle } which can be derived from the above string ⟨A,B,C,D,E,F⟩{displaystyle langle A,B,C,D,E,Frangle } by deleting substring ⟨E,F⟩{displaystyle langle E,Frangle }. The substring is a refinement of the subsequence.
The list of all subsequences for the word "apple" would be "a, ap, al, ae, app, apl, ape, ale, appl, appe, aple, apple, p, pp, pl, pe, ppl, ppe, ple, pple, l, le, e".
Contents
1 Common subsequence
2 Applications
3 Theorems
4 See also
5 Notes
Common subsequence
Given two sequences X and Y, a sequence Z is said to be a common subsequence of X and Y, if Z is a subsequence of both X and Y. For example, if
X=⟨A,C,B,D,E,G,C,E,D,B,G⟩{displaystyle X=langle A,C,B,D,E,G,C,E,D,B,Grangle } and
- Y=⟨B,E,G,C,F,E,U,B,K⟩{displaystyle Y=langle B,E,G,C,F,E,U,B,Krangle }
then a common subsequence of X and Y could be
- Z=⟨B,E,E⟩.{displaystyle Z=langle B,E,Erangle .}
This would not be the longest common subsequence, since Z only has length 3, and the common subsequence ⟨B,E,E,B⟩{displaystyle langle B,E,E,Brangle } has length 4. The longest common subsequence of X and Y is ⟨B,E,G,C,E,B⟩{displaystyle langle B,E,G,C,E,Brangle }.
Applications
Subsequences have applications to computer science,[1] especially in the discipline of bioinformatics, where computers are used to compare, analyze, and store DNA, RNA, and protein sequences.
Take two sequences of DNA containing 37 elements, say:
- SEQ1 = ACGGTGTCGTGCTATGCTGATGCTGACTTATATGCTA
- SEQ2 = CGTTCGGCTATCGTACGTTCTATTCTATGATTTCTAA
The longest common subsequence of sequences 1 and 2 is:
- LCS(SEQ1,SEQ2) = CGTTCGGCTATGCTTCTACTTATTCTA
This can be illustrated by highlighting the 27 elements of the longest common subsequence into the initial sequences:
- SEQ1 = ACGGTGTCGTGCTATGCTGATGCTGACTTATATGCTA
- SEQ2 = CGTTCGGCTATCGTACGTTCTATTCTATGATTTCTAA
Another way to show this is to align the two sequences, i.e., to position elements of the longest common subsequence in a same column (indicated by the vertical bar) and to introduce a special character (here, a dash) in one sequence when two elements in the same column differ:
- SEQ1 = ACGGTGTCGTGCTAT-G--C-TGATGCTGA--CT-T-ATATG-CTA-
- | || ||| ||||| | | | | || | || | || | |||
- SEQ2 = -C-GT-TCG-GCTATCGTACGT--T-CT-ATTCTATGAT-T-TCTAA
Subsequences are used to determine how similar the two strands of DNA are, using the DNA bases: adenine, guanine, cytosine and thymine.
Theorems
- Every infinite sequence of real numbers has an infinite monotone subsequence (This is a lemma used in the proof of the Bolzano–Weierstrass theorem).
- Every infinite bounded sequence in Rn has a convergent subsequence (This is the Bolzano–Weierstrass theorem).
- For all integers r and s, every finite sequence of length at least (r − 1)(s − 1) + 1 contains a monotonically increasing subsequence of length r or a monotonically decreasing subsequence of length s (This is the Erdős–Szekeres theorem).
See also
Subsequential limit - the limit of some subsequence.- Limit superior and limit inferior
- Longest increasing subsequence problem
Notes
^ In computer science, string is often used as a synonym for sequence, but it is important to note that substring and subsequence are not synonyms. Substrings are consecutive parts of a string, while subsequences need not be. This means that a substring of a string is always a subsequence of the string, but a subsequence of a string is not always a substring of the string, see: Gusfield, Dan (1999) [1997]. Algorithms on Strings, Trees and Sequences: Computer Science and Computational Biology. USA: Cambridge University Press. p. 4. ISBN 0-521-58519-8..mw-parser-output cite.citation{font-style:inherit}.mw-parser-output .citation q{quotes:"""""""'""'"}.mw-parser-output .citation .cs1-lock-free a{background:url("//upload.wikimedia.org/wikipedia/commons/thumb/6/65/Lock-green.svg/9px-Lock-green.svg.png")no-repeat;background-position:right .1em center}.mw-parser-output .citation .cs1-lock-limited a,.mw-parser-output .citation .cs1-lock-registration a{background:url("//upload.wikimedia.org/wikipedia/commons/thumb/d/d6/Lock-gray-alt-2.svg/9px-Lock-gray-alt-2.svg.png")no-repeat;background-position:right .1em center}.mw-parser-output .citation .cs1-lock-subscription a{background:url("//upload.wikimedia.org/wikipedia/commons/thumb/a/aa/Lock-red-alt-2.svg/9px-Lock-red-alt-2.svg.png")no-repeat;background-position:right .1em center}.mw-parser-output .cs1-subscription,.mw-parser-output .cs1-registration{color:#555}.mw-parser-output .cs1-subscription span,.mw-parser-output .cs1-registration span{border-bottom:1px dotted;cursor:help}.mw-parser-output .cs1-ws-icon a{background:url("//upload.wikimedia.org/wikipedia/commons/thumb/4/4c/Wikisource-logo.svg/12px-Wikisource-logo.svg.png")no-repeat;background-position:right .1em center}.mw-parser-output code.cs1-code{color:inherit;background:inherit;border:inherit;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;font-size:100%}.mw-parser-output .cs1-visible-error{font-size:100%}.mw-parser-output .cs1-maint{display:none;color:#33aa33;margin-left:0.3em}.mw-parser-output .cs1-subscription,.mw-parser-output .cs1-registration,.mw-parser-output .cs1-format{font-size:95%}.mw-parser-output .cs1-kern-left,.mw-parser-output .cs1-kern-wl-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right,.mw-parser-output .cs1-kern-wl-right{padding-right:0.2em}
This article incorporates material from subsequence on PlanetMath, which is licensed under the Creative Commons Attribution/Share-Alike License.