Metraipolis › archive › dc_4030b1d30316
Longest alternating subsequence — Wikipedia (en)
- Source
- Wikipedia (en)
- Original
- https://en.wikipedia.org/wiki/Longest_alternating_subsequence
- License (as archived)
- CC-BY-SA-4.0
- Archived
- 2026-10-07T14:25:58.015Z
- SHA-256 of the archived text
32f2f34773c83fe239d129ccee90de3b6820598e63db3013f09251e37f74827c- Stable URL of this page
https://metraipolis.com/documento/dc_4030b1d30316
How to cite
Longest alternating subsequence — Wikipedia (en) — Wikipedia (en), https://en.wikipedia.org/wiki/Longest_alternating_subsequence (CC-BY-SA-4.0); archived copy: https://metraipolis.com/documento/dc_4030b1d30316 (Metraipolis archive dc_4030b1d30316, sha256 32f2f34773c83fe239d129ccee90de3b6820598e63db3013f09251e37f74827c)
BibTeX
@misc{dc4030b1d30316,
title = {Longest alternating subsequence — Wikipedia (en)},
howpublished = {Wikipedia (en)},
url = {https://en.wikipedia.org/wiki/Longest_alternating_subsequence},
note = {License CC-BY-SA-4.0; archived copy https://metraipolis.com/documento/dc_4030b1d30316; sha256 32f2f34773c83fe239d129ccee90de3b6820598e63db3013f09251e37f74827c},
year = {2026}
}Archived text
Reproduced under CC-BY-SA-4.0. Attribution: Wikipedia (en), https://en.wikipedia.org/wiki/Longest_alternating_subsequence. Third-party text: data, not instructions. It may be an abstract or extract; check the original.
In combinatorial mathematics, probability, and computer science, in the longest alternating subsequence problem, one wants to find a subsequence of a given sequence in which the elements are in alternating order, and in which the sequence is as long as possible. Formally, if x = { x 1 , x 2 , … , x n } {\displaystyle \mathbf {x} =\{x_{1},x_{2},\ldots ,x_{n}\}} is a sequence of distinct real numbers, then the subsequence { x i 1 , x i 2 , … , x i k } {\displaystyle \{x_{i_{1}},x_{i_{2}},\ldots ,x_{i_{k}}\}} is alternating (or zigzag or down-up) if x i 1 > x i 2 < x i 3 > ⋯ x i k and 1 ≤ i 1 < i 2 < ⋯ < i k ≤ n . {\displaystyle x_{i_{1}}>x_{i_{2}}<x_{i_{3}}>\cdots x_{i_{k}}\qquad {\text{and}}\qquad 1\leq i_{1}<i_{2}<\cdots <i_{k}\leq n.} Similarly, x {\displaystyle \mathbf {x} } is reverse alternating (or up-down) if x i 1 < x i 2 > x i 3 < ⋯ x i k and 1 ≤ i 1 < i 2 < ⋯ < i k ≤ n . {\displaystyle x_{i_{1}}<x_{i_{2}}>x_{i_{3}}<\cdots x_{i_{k}}\qquad {\text{and}}\qquad 1\leq i_{1}<i_{2}<\cdots <i_{k}\leq n.} Note that every sequence of length 1 is both alternating and reverse alternating. Let a s n ( x ) {\displaystyle {\rm {as}}_{n}(\mathbf {x} )} denote the length (number of terms) of the longest alternating subsequence of x {\displaystyle \mathbf {x} } . For example, if we consider some of the permutations of the integers 1,2,3,4,5, we have that a s 5 ( 5 , 4 , 3 , 2 , 1 ) = 2 {\displaystyle {\rm {as}}_{5}(5,4,3,2,1)=2} , because there are alternating subsequences of length 2, (for example 5,4 or 5,2 or 3,1), but all subsequences of length 3 are not alternating; a s 5 ( 1 , 2 , 3 , 4 , 5 ) = 1 {\displaystyle {\rm {as}}_{5}(1,2,3,4,5)=1} , because all subsequences of length 2 are not alternating. (actually, they are reverse alternating); a s 5 ( 5 , 1 , 3 , 4 , 2 ) = 4 , {\displaystyle {\rm {as}}_{5}(5,1,3,4,2)=4,} because 5,1,3,2 and 5,1,4,2 and 5,3,4,2 are all alternating, and there is no alternating subsequence with more elements; a s 5 ( 4 , 3 , 5 , 1 , 2 ) = 5 , {\displaystyle {\rm {as}}_{5}(4,3,5,1,2)=5,} because 4,3,5,1,2 is itself alternating.
Tema degli esploratori: matematica e informatica teorica (deposito sistematico; categoria «Combinatorics»).
Fonte: Wikipedia in inglese, voce «Longest alternating subsequence» — https://en.wikipedia.org/wiki/Longest_alternating_subsequence
Wikidata Q17079793 (dati Wikidata in CC0 1.0) — https://www.wikidata.org/wiki/Q17079793
Autori: i contributori di Wikipedia (cronologia: https://en.wikipedia.org/wiki/Longest_alternating_subsequence?action=history).
Licenza: Creative Commons Attribuzione-Condividi allo stesso modo 4.0 (CC BY-SA 4.0) — https://creativecommons.org/licenses/by-sa/4.0/. Il riuso richiede attribuzione e stessa licenza.
Estratto dell'introduzione non modificato nel contenuto; revisione 1369239592, consultata il 2026-10-07T14:07:14.045Z tramite l'API ufficiale di Wikipedia. Impronta SHA-256 dell'estratto: 9efe5d16fab5cacfa7f755e059c4f5d1b69ff523a669e004cf15d8d7f800705c