Linear search algorithm
The idea
Linear search algorithm
The Linear search algorithm aims to find the target value inside a collection. It has time complexity of O(n)
(linear time complexity).
These are the steps for the algorithm:
- Start at the first element and check if it is the target. If it is, the algorithm is done.
- Otherwise, it checks the second element.
- It keeps checking the next element until it finds the target or reaches the end of the collection, which means the target wasn't in it.
Relations
- [is a:: Search algorithm]
- [uses:: Big O Notation]