<s>
In	O
combinatorial	O
mathematics	O
,	O
probability	O
,	O
and	O
computer	B-General_Concept
science	I-General_Concept
,	O
in	O
the	O
longest	B-Algorithm
alternating	I-Algorithm
subsequence	I-Algorithm
problem	O
,	O
one	O
wants	O
to	O
find	O
a	O
subsequence	O
of	O
a	O
given	O
sequence	O
in	O
which	O
the	O
elements	O
are	O
in	O
alternating	O
order	O
,	O
and	O
in	O
which	O
the	O
sequence	O
is	O
as	O
long	O
as	O
possible	O
.	O
</s>
<s>
Let	O
denote	O
the	O
length	O
(	O
number	O
of	O
terms	O
)	O
of	O
the	O
longest	B-Algorithm
alternating	I-Algorithm
subsequence	I-Algorithm
of	O
.	O
</s>
<s>
The	O
longest	B-Algorithm
alternating	I-Algorithm
subsequence	I-Algorithm
problem	O
is	O
solvable	O
in	O
time	O
,	O
where	O
is	O
the	O
length	O
of	O
the	O
original	O
sequence	O
.	O
</s>
<s>
The	O
longest	B-Algorithm
alternating	I-Algorithm
subsequence	I-Algorithm
problem	O
has	O
also	O
been	O
studied	O
in	O
the	O
setting	O
of	O
online	B-Algorithm
algorithms	I-Algorithm
,	O
in	O
which	O
the	O
elements	O
of	O
are	O
presented	O
in	O
an	O
online	O
fashion	O
,	O
and	O
a	O
decision	O
maker	O
needs	O
to	O
decide	O
whether	O
to	O
include	O
or	O
exclude	O
each	O
element	O
at	O
the	O
time	O
it	O
is	O
first	O
presented	O
,	O
without	O
any	O
knowledge	O
of	O
the	O
elements	O
that	O
will	O
be	O
presented	O
in	O
the	O
future	O
,	O
</s>
