An algorithm is a sequence of well-defined steps that defines an abstract solution to a problem. Use this tag when your issue is related to design and analysis of algorithms.

An algorithm is a finite description of a computational process that transforms input data into output data.

And an algorithm is a set of ordered instructions based on a formal language with the following conditions:

  • Finite. The number of instructions must be finite.
  • Executable. All instructions must be executable in some language-dependent way, in a finite amount of time.

An algorithm does not have to be deterministic - there are many random-based algorithms, e.g. QuickSort with selecting the pivot element randomly.

An algorithm can be expressed in many ways:

  • As a sequence of instructions
  • As a block-scheme
  • As a code in an existing or new programming language
  • As a piece of text in a human language
  • As a realization in a formal model of computation such as a Turing machine
  • Or in other, similar ways

An algorithm can solve a class of problems. For example, both "sum 1 and 3" and "sum 4 and 5" are problems in the same class: "sum two integer numbers." Furthermore, a given class of problems can generally be solved by a variety of algorithms.

Questions tagged with typically ask for an algorithm to solve a specific task, or ask for an analysis of a given algorithm (note also . In the former case, it is possible to ask for an algorithm whose resource (time/memory/etc.) consumption is somehow bounded.

Questions which seek the intrinsic difficulty of some problem (rather than some specific algorithm) are better tagged with .