What’s an Algorithm?

Print anything with Printful



An algorithm is a set of instructions that lead to a predictable outcome. Examples include assembling a model airplane, computer programs, and solving equations. Algorithms can be classified into types such as dynamic programming, greedy, and brute-force. They can also be divided into serial and parallel algorithms.

In its most general sense, an algorithm is any set of detailed instructions that results in a predictable final state from a known start. Algorithms are only as good as the instructions provided, however, and the result will be incorrect if the algorithm is not defined correctly.

Examples of algorithms

A common example of an algorithm is the instructions for assembling a model airplane. Given the initial set of a number of marked pieces, one can follow the instructions provided to achieve a predictable final state: the completed aircraft. Misprints in the instructions or failure to follow a correct step will result in a defective final product.

A computer program is another pervasive example. Every computer program is simply a series of instructions, which can vary in complexity, and are listed in a specific order, designed to perform a specific task. Mathematics also uses algorithms to solve equations by hand, without the use of a calculator. A final example is the human brain: most conceptions of the human brain define all behavior, from acquiring food to falling in love, as the result of a complex algorithm.

Algorithms classes
While there is no universally accepted subdivision for the various types of algorithms, there are common classes to which algorithms are often agreed to belong. Among these are:

Dynamic Programming Algorithms: This class remembers previous results and tries to use them to speed up the process of finding new results.

Greedy Algorithms: Greedy algorithms attempt not only to find a solution, but also to find the ideal solution to a given problem.

Brute-Force Algorithms: The brute-force approach starts at a random point and cycles through each possibility until it finds the solution.

Randomized algorithms: This class includes any algorithm that uses a random number at any point during its process.

Branch and Bound Algorithms: Branch and Bound algorithms form a tree of subproblems to the primary problem, following each branch until it is solved or grouped with another branch.

Simple recursive algorithms: This type goes for a direct solution immediately, then goes back to find a simpler solution.

Backtracking algorithms: testing backtracking algorithms for a solution; if a solution is found the algorithm has solved, otherwise it reoccurs once and tries again, continuing until a solution is found.

Divide and Conquer Algorithms: A divide and conquer algorithm is similar to a branch and bound algorithm, except that it uses the backtracking method of recurrence when dividing a problem into subproblems.

Serial and parallel algorithms
In addition to these general classes, algorithms can also be divided into two primary groups: serial algorithms, designed for serial execution, where each operation is performed in a linear order; and parallel algorithms, used with computers running parallel processors, in which a number of operations are performed parallel to each other. Parallel algorithms also exist in the natural world in the case, for example, of genetic mutations in a species.




Protect your devices with Threat Protection by NordVPN


Skip to content