The linear search is the simplest search algorithm. Linear means 'in a line'. The algorithm is given the search term and then, starting at the beginning, it compares the search term to the first item in the set of data.
If the search term and the item match, the item has been found.
If not, the algorithm looks at the next item in the data set, and so on, until the item is found or the end of the data set is reached.
A linear search can be efficient with a very small set of data.
A much faster, more efficient search is the binary search. However, to perform a binary search the data must be sorted. Either alphabetically, if text, or low to high or high to low if numerical data. A binary search is much faster when using a large set of data.
In a binary search, the mid point of the list is found. It is then compared to the search term. The mid point will either be the search term (algorithm stops), or be higher or lower than the search term. Half the list is then discarded (including the mid point). This process repeats until the item is found or the end of the list is reached.