Content deleted Content added
MOS:CAPS |
m Minor structural changes - syntax |
||
Line 5:
}}
[[File:Hash table 3 1 1 0 1 0 0 SP.svg|thumb|upright=1.2|Visual representation of a [[hash table]], a [[data structure]] that allows for fast retrieval of information.]]
In [[computer science]], a '''search algorithm''' is an [[algorithm]] (
While the search problems described above and [[web search]] are both problems in information retrieval, they are generally studied as separate subfields and are solved and evaluated differently. Web search problems are generally focused on filtering and finding documents
The appropriate search algorithm often depends on the data structure being searched, and may also include prior knowledge about the data. Search algorithms can be made faster or more efficient by specially constructed database structures, such as [[search tree]]s, [[hash map]]s, and [[database index]]es. {{Sfn|Beame|Fich|2002|p=39}}{{full citation needed|date=April 2021}}{{Sfn|Knuth|1998|loc=§6.5 ("Retrieval on Secondary Keys")}}
Search algorithms can be classified based on their mechanism of searching into three types of algorithms: linear, binary, and hashing. [[Linear search]] algorithms check every record for the one associated with a target key in a linear fashion.{{Sfn|Knuth|1998|loc=§6.1 ("Sequential Searching")}} [[Binary search algorithm|Binary, or half-interval, searches]] repeatedly target the center of the search structure and divide the search space in half. Comparison search algorithms improve on linear searching by successively eliminating records based on comparisons of the keys until the target record is found, and can be applied on data structures with a defined order.{{Sfn|Knuth|1998|loc=§6.2 ("Searching by Comparison of Keys")}} Digital search algorithms work based on the properties of digits in data structures
Algorithms are often evaluated by their [[computational complexity]], or maximum theoretical run time. Binary search functions, for example, have a maximum complexity of {{math|''O''(log ''n'')}}, or logarithmic time.
== Applications of search algorithms ==
|