Tag Info

This tag is for questions about presenting specific algorithms or general principles of algorithmic design and analysis to students. It IS NOT for questions about writing or fixing algorithms.

An algorithm is a set of ordered instructions based on a formal language that has a finite number of instructions to solve a problem. An algorithm does not have to be deterministic - there are many random-based algorithms, e.g. QuickSort which selects 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

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

A key algorithm classification is known as Algorithm Complexity.

Another important step of algorithm design is proof of correctness. Algorithms should actually provide correct results for any instance of the problem. We should always take care that all the conditions where the proposed algorithm might fail are covered. This can be done using several techniques, for example Model Checking, Assertion, and Loop Invariant.