Online algorithm

From Wiki @ Karl Jones dot com
Revision as of 19:53, 16 May 2016 by Karl Jones (Talk | contribs) (Performance)

Jump to: navigation, search

In computer science, an online algorithm is an algorithm that can process its input piece-by-piece in a serial fashion, i.e., in the order that the input is fed to the algorithm, without having the entire input available from the start.

In contrast, an offline algorithm is given the whole problem data from the beginning and is required to output an answer which solves the problem at hand.

Example: Insert sort

The insertion sort algorithm considers one input element per iteration and produces a partial solution without considering future elements.

Thus, insertion sort is an online algorithm.

By contrast, selection sort repeatedly selects the minimum element from the unsorted remainder and places it at the front, which requires access to the entire input; it is thus an offline algorithm.

Performance

For many problems, online algorithms cannot match the performance of offline algorithms.

If the ratio between the performance of an online algorithm and an optimal offline algorithm is bounded, the online algorithm is called competitive.

Offline counterparts

Not every online algorithm has an offline counterpart.

See also

External links