Longest alternating subsequence

From formulasearchengine
Jump to navigation Jump to search

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[1] (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

Efficient algorithms

The longest alternating subsequence problem is solvable in time , where is the length of the original sequence.

Distributional results

If is a random permutation of the integers and , then it is possible to show[2][3][4] that

Moreover, as , the random variable , appropriately centered and scaled, converges to a standard normal distribution.

Online algorithms

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 .[5]

As , the optimal number of online alternating selections appropriately centered and scaled converges to a normal distribution.

See also


  1. {{#invoke:citation/CS1|citation |CitationClass=citation }}
  2. {{#invoke:citation/CS1|citation |CitationClass=citation }}
  3. {{#invoke:citation/CS1|citation |CitationClass=citation }}
  4. {{#invoke:citation/CS1|citation |CitationClass=citation }}
  5. {{#invoke:citation/CS1|citation |CitationClass=citation }}