<s>
Competitive	B-Algorithm
analysis	I-Algorithm
is	O
a	O
method	O
invented	O
for	O
analyzing	O
online	B-Algorithm
algorithms	I-Algorithm
,	O
in	O
which	O
the	O
performance	O
of	O
an	O
online	B-Algorithm
algorithm	I-Algorithm
(	O
which	O
must	O
satisfy	O
an	O
unpredictable	O
sequence	O
of	O
requests	O
,	O
completing	O
each	O
request	O
without	O
being	O
able	O
to	O
see	O
the	O
future	O
)	O
is	O
compared	O
to	O
the	O
performance	O
of	O
an	O
optimal	O
offline	B-Algorithm
algorithm	I-Algorithm
that	O
can	O
view	O
the	O
sequence	O
of	O
requests	O
in	O
advance	O
.	O
</s>
<s>
An	O
algorithm	O
is	O
competitive	O
if	O
its	O
competitive	B-Algorithm
ratio	I-Algorithm
—	O
the	O
ratio	O
between	O
its	O
performance	O
and	O
the	O
offline	B-Algorithm
algorithm	I-Algorithm
's	O
performance	O
—	O
is	O
bounded	O
.	O
</s>
<s>
Unlike	O
traditional	O
worst-case	B-General_Concept
analysis	I-General_Concept
,	O
where	O
the	O
performance	O
of	O
an	O
algorithm	O
is	O
measured	O
only	O
for	O
"	O
hard	O
"	O
inputs	O
,	O
competitive	B-Algorithm
analysis	I-Algorithm
requires	O
that	O
an	O
algorithm	O
perform	O
well	O
both	O
on	O
hard	O
and	O
easy	O
inputs	O
,	O
where	O
"	O
hard	O
"	O
and	O
"	O
easy	O
"	O
are	O
defined	O
by	O
the	O
performance	O
of	O
the	O
optimal	O
offline	B-Algorithm
algorithm	I-Algorithm
.	O
</s>
<s>
Such	O
data-dependent	O
algorithms	O
are	O
analysed	O
for	O
average-case	B-General_Concept
and	O
worst-case	B-General_Concept
data	O
.	O
</s>
<s>
Competitive	B-Algorithm
analysis	I-Algorithm
is	O
a	O
way	O
of	O
doing	O
worst	B-General_Concept
case	I-General_Concept
analysis	O
for	O
on-line	O
and	O
randomized	B-General_Concept
algorithms	I-General_Concept
,	O
which	O
are	O
typically	O
data	O
dependent	O
.	O
</s>
<s>
In	O
competitive	B-Algorithm
analysis	I-Algorithm
,	O
one	O
imagines	O
an	O
"	O
adversary	B-Algorithm
"	O
which	O
deliberately	O
chooses	O
difficult	O
data	O
,	O
to	O
maximize	O
the	O
ratio	O
of	O
the	O
cost	O
of	O
the	O
algorithm	O
being	O
studied	O
and	O
some	O
optimal	O
algorithm	O
.	O
</s>
<s>
When	O
considering	O
a	O
randomized	B-General_Concept
algorithm	I-General_Concept
,	O
one	O
must	O
further	O
distinguish	O
between	O
an	O
oblivious	O
adversary	B-Algorithm
,	O
which	O
has	O
no	O
knowledge	O
of	O
the	O
random	O
choices	O
made	O
by	O
the	O
algorithm	O
pitted	O
against	O
it	O
,	O
and	O
an	O
adaptive	O
adversary	B-Algorithm
which	O
has	O
full	O
knowledge	O
of	O
the	O
algorithm	O
's	O
internal	O
state	O
at	O
any	O
point	O
during	O
its	O
execution	O
.	O
</s>
<s>
(	O
For	O
a	O
deterministic	O
algorithm	O
,	O
there	O
is	O
no	O
difference	O
;	O
either	O
adversary	B-Algorithm
can	O
simply	O
compute	O
what	O
state	O
that	O
algorithm	O
must	O
have	O
at	O
any	O
time	O
in	O
the	O
future	O
,	O
and	O
choose	O
difficult	O
data	O
accordingly	O
.	O
)	O
</s>
<s>
For	O
example	O
,	O
the	O
quicksort	B-Algorithm
algorithm	O
chooses	O
one	O
element	O
,	O
called	O
the	O
"	O
pivot	O
"	O
,	O
that	O
is	O
,	O
on	O
average	O
,	O
not	O
too	O
far	O
from	O
the	O
center	O
value	O
of	O
the	O
data	O
being	O
sorted	O
.	O
</s>
<s>
Quicksort	B-Algorithm
then	O
separates	O
the	O
data	O
into	O
two	O
piles	O
,	O
one	O
of	O
which	O
contains	O
all	O
elements	O
with	O
value	O
less	O
than	O
the	O
value	O
of	O
the	O
pivot	O
,	O
and	O
the	O
other	O
containing	O
the	O
rest	O
of	O
the	O
elements	O
.	O
</s>
<s>
If	O
quicksort	B-Algorithm
chooses	O
the	O
pivot	O
in	O
some	O
deterministic	O
fashion	O
(	O
for	O
instance	O
,	O
always	O
choosing	O
the	O
first	O
element	O
in	O
the	O
list	O
)	O
,	O
then	O
it	O
is	O
easy	O
for	O
an	O
adversary	B-Algorithm
to	O
arrange	O
the	O
data	O
beforehand	O
so	O
that	O
quicksort	B-Algorithm
will	O
perform	O
in	O
worst-case	B-General_Concept
time	O
.	O
</s>
<s>
If	O
,	O
however	O
,	O
quicksort	B-Algorithm
chooses	O
some	O
random	O
element	O
to	O
be	O
the	O
pivot	O
,	O
then	O
an	O
adversary	B-Algorithm
without	O
knowledge	O
of	O
what	O
random	O
numbers	O
are	O
coming	O
up	O
cannot	O
arrange	O
the	O
data	O
to	O
guarantee	O
worst-case	B-General_Concept
execution	O
time	O
for	O
quicksort	B-Algorithm
.	O
</s>
<s>
The	O
classic	O
on-line	O
problem	O
first	O
analysed	O
with	O
competitive	B-Algorithm
analysis	I-Algorithm
is	O
the	O
list	B-Algorithm
update	I-Algorithm
problem	I-Algorithm
:	O
Given	O
a	O
list	O
of	O
items	O
and	O
a	O
sequence	O
of	O
requests	O
for	O
the	O
various	O
items	O
,	O
minimize	O
the	O
cost	O
of	O
accessing	O
the	O
list	O
where	O
the	O
elements	O
closer	O
to	O
the	O
front	O
of	O
the	O
list	O
cost	O
less	O
to	O
access	O
.	O
</s>
<s>
Competitive	B-Algorithm
analysis	I-Algorithm
was	O
used	O
to	O
show	O
that	O
an	O
adversary	B-Algorithm
can	O
make	O
Transpose	O
perform	O
arbitrarily	O
badly	O
compared	O
to	O
an	O
optimal	O
algorithm	O
,	O
whereas	O
Move-To-Front	O
can	O
never	O
be	O
made	O
to	O
incur	O
more	O
than	O
twice	O
the	O
cost	O
of	O
an	O
optimal	O
algorithm	O
.	O
</s>
<s>
That	O
is	O
,	O
the	O
algorithm	O
does	O
not	O
"	O
know	O
"	O
the	O
future	O
,	O
while	O
the	O
imaginary	O
adversary	B-Algorithm
(	O
the	O
"	O
competitor	O
"	O
)	O
"	O
knows	O
"	O
.	O
</s>
