> For the complete documentation index, see [llms.txt](https://bryan-guner.gitbook.io/my-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bryan-guner.gitbook.io/my-docs/data-structures-and-algorithms/graph/linear-search.md).

# Linear Search

## Linear Search

In computer science, linear search or sequential search is a method for finding a target value within a list. It sequentially checks each element of the list for the target value until a match is found or until all the elements have been searched. Linear search runs in at worst linear time and makes at most `n` comparisons, where `n` is the length of the list.

![Linear Search](https://www.tutorialspoint.com/data_structures_algorithms/images/linear_search.gif)

### Complexity

**Time Complexity**: `O(n)` - since in worst case we're checking each element exactly once.

### References

* [Wikipedia](https://en.wikipedia.org/wiki/Linear_search)
* [TutorialsPoint](https://www.tutorialspoint.com/data_structures_algorithms/linear_search_algorithm.htm)
* [Youtube](https://www.youtube.com/watch?v=SGU9duLE30w)
