Microsoft Store
 

Algorithm


 

In mathematics and computer science an algorithm (the word is derived from the name of the Persian mathematician Al-Khwarizmi) is a finite set of well-defined instructions for accomplishing some task which, given an initial state, will terminate in a corresponding recognizable end-state (contrast with heuristic). Algorithms can be implemented by computer programs, although often in restricted forms; mistakes in implementation and limitations of the computer can prevent a computer program from correctly executing its intended algorithm.

Formalized algorithms

Algorithms are essential to the way computers process information, because a computer program is essentially an algorithm that tells the computer what specific steps to perform (in what specific order) in order to carry out a

Related Topics:
Computer - Computer program

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

specified task, such as calculating employees’ paychecks or printing students’ report cards. Thus, an algorithm can be considered to be any sequence of operations which can be performed by a Turing-complete system.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Typically, when an algorithm is associated with processing information, data is read from an input source or device, written to an output sink or device, and/or stored for further use. Stored data is regarded as part of the internal state of the entity performing the algorithm.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

For any such computational process, the algorithm must be rigorously defined: specified in the way it applies in all possible circumstances that could arise. That is, any conditional steps must be systematically dealt with, case-by-case; the criteria for each case must be clear (and computable).

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

Because an algorithm is a precise list of precise steps, the order of computation will almost always be critical to the functioning of the algorithm. Instructions are usually assumed to be listed explicitly, and are described as starting 'from the top' and going 'down to the bottom', an idea that is described more formally by flow of control.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

So far, this discussion of the formalisation of an algorithm has assumed the premises of imperative programming. This is the most common conception, and it attempts to describe a task in discrete, 'mechanical' means. Unique to this conception of formalized algorithms is the assignment operation, setting the value of a variable. It derives from the intuition of 'memory' as a scratchpad. There is an example below of such an assignment.

Related Topics:
Imperative programming - Assignment operation - Memory

~ ~ ~ ~ ~ ~ ~ ~ ~ ~

See functional programming and logic programming for alternate conceptions of what constitutes an algorithm.

Related Topics:
Functional programming - Logic programming

~ ~ ~ ~ ~ ~ ~ ~ ~ ~