Algorithm

An algorithm is a step-by-step method for solving all problems of a given type.

There are a variety of algorithmic techniques for visiting or checking every edge and every vertex of a graph. A depth-first algorithm explores the graph by looking for new vertices further and further away from the starting point, taking closer vertices only when no more can be found far away. A breadth-first algorithm will first search the area closest to the starting point, moving farther away only when everything close has already been looked at.

Exhaustive algorithms are algorithms that are designed to examine systematically every possibility in search of a solution. Although exhaustive algorithms will theoretically produce a solution, often the amount of time or resources required to make the exhaustive search is prohibitive. Sometimes the term brute-force algorithm is used to refer to algorithms that are exhaustive. Problems that can only be solved by exhaustive algorithms that would take prohibitively long to run are called intractable problems.

A recursive algorithm is one that calls or makes use of itself. An important part of a recursive algorithm is a termination condition that, once it is met, will cause the algorithm to cease calling itself and stop.