Sequential Search Algorithm

A sequential search, also called a linear search, is a searching algorithm with a time complexity of O(n). It searches through an array element-by-element, so its worst case is going through n elements in an array. Due to its linear searching style, sequential search is only effectively used on unsorted data because there are faster options for sorted data.


Below is a C++ implementation of a sequential search algorithm: