Search algorithm (source code)

= Search algorithm

A <search algorithm> looks for an object satisfying a specified condition within a collection or state space. <Linear search> inspects entries directly; <binary search> exploits sorted order; <breadth-first search> explores <graph states> by distance from a start. The specification should say whether to return one witness, every witness or <proof> of absence. A procedure that eventually finds every reachable witness may still fail to terminate when none exists in an infinite space. Representation and available structure determine which candidates can safely be ruled out without inspection.