In computer science, a search algorithm, broadly speaking, is an algorithm that takes a problem as input and returns a solution to the problem. Most of the algorithms studied by computer scientists that solve problems are kinds of search algorithms. The set of all possible solutions to a problem is called the search space. Brute force or "naive" search algorithms use the simplest, most intuitive method of searching through the search space, whereas search algorithms that use heuristics apply knowledge about the structure of the search space to try to reduce the amount of time spent searching.
List search algorithms are perhaps the most basic kind of search algorithm. The goal is to find one element of a set by some key (perhaps containing other information related to the key). As this is a common problem in computer science, the computational complexity of these algorithms has been well studied. The simplest such algorithm is linear search. It has O(n) running time, but can operate on a list containing the elements of the set. A more sophisticated list search algorithm is binary search. It runs in O(log(n)). This is significantly better than linear search for large lists of data, but it requires that the list be sorted before searching (see sort algorithm) and also be random access. Interpolation search is better than binary search for large sorted lists. However, the underlying data structure must allow such kind of searching. Hash tables are also used for search; they are the method of choice in most circumstances today. Grover's algorithm is a quantum algorithm that offers quadratic speedup over the classical linear search for unsorted lists.
Tree search algorithms search nodes of tree graphs, and many of the problems in graph theory are solved using search algorithms.
String searching algorithms search for patterns within strings.
Genetic algorithms use ideas from evolution as heuristics for reducing the search space.
Simulated annealing is a probabilistic search algorithm.