For example, sorting an array of elements varies in difficulty depending on the initial order.
For example, the quicksort algorithm chooses one element, called the "pivot", that is, on average, not too far from the center value of the data being sorted.
The Move-To-Front algorithm simply moves the requested item to the front after the access, at no cost.
Competitive analysis was used to show that an adversary can make Transpose perform arbitrarily badly compared to an optimal algorithm, whereas Move-To-Front can never be made to incur more than twice the cost of an optimal algorithm.
In the case of online requests from a server, competitive algorithms are used to overcome uncertainties about the future.