Longest alternating subsequence
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 is a sequence of distinct real numbers, then the subsequence is alternating (or zigzag or down-up)if
Similarly, is reverse alternating (or up-down) if
Let denote the length (number of terms) of the longest alternating subsequence of . For example, if we consider some of the permutations of the integers 1,2,3,4,5, we have that
- ; because any sequence of 2 distinct digits are (by definition) alternating. (for example 1,2 or 1,4 or 3,5)
- because 1,5,3,4 and 1,5,2,4 and 1,3,2,4 are all alternating, and there is no alternating subsequence with more elements;
- because 5,3,4,1,2 is itself alternating.
The longest alternating subsequence problem is solvable in time , where is the length of the original sequence.
Moreover, as , the random variable , appropriately centered and scaled, converges to a standard normal distribution.
The longest alternating subsequence problem has also been studied in the setting of online algorithms, in which the elements of are presented in an online fashion, and a decision maker needs to decide whether to include or exclude each element at the time it is first presented, without any knowledge of the elements that will be presented in the future, and without the possibility of recalling on preceding observations.
Given a sequence of independent random variables with common continuous distribution , it is possible to construct a selection procedure that maximizes the expected number of alternating selections. Such expected values can be tightly estimated, and it equals .
As , the optimal number of online alternating selections appropriately centered and scaled converges to a normal distribution.
- Alternating permutation
- Permutation pattern and pattern avoidance
- Counting local maxima and/or local minima in a given sequence
- Turning point tests for testing statistical independence of observations
- Number of alternating runs
- Longest increasing subsequence
- Longest common subsequence problem
- Stanley, Richard P. (2011), Enumerative Combinatorics, Volume I, second edition, Cambridge University Press
- Widom, Harold (2006), "On the limiting distribution for the length of the longest alternating sequence in a random permutation", Electron. J. Combin. 13: Research Paper 25, 7
- Stanley, Richard P. (2008), "Longest alternating subsequences of permutations", Michigan Math. J. 57: 675–687, doi:10.1307/mmj/1220879431
- Houdré, Christian; Restrepo, Ricardo (2010), "A probabilistic approach to the asymptotics of the length of the longest alternating subsequence", Electron. J. Combin. 17: Research Paper 168, 19
- Arlotto, Alessandro; Chen, Robert W.; Shepp, Lawrence A.; Steele, J. Michael (2011), "Online selection of alternating subsequences from a random sample", J. Appl. Probab. 48 (4): 1114–1132, doi:10.1239/jap/1324046022
- Arlotto, Alessandro; Steele, J. Michael (2014), "Optimal online selection of an alternating subsequence: a central limit theorem", Adv. in Appl. Probab. 46 (2): 536–559, doi:10.1239/aap/1401369706