A linear search moves sequentially through a list looking for a target value.
🔔 Complexity is considered in terms of worst case.
| Notes | |
|---|---|
| Θ(n) |
| Notes | |
|---|---|
| Θ(1) | Space taken by linear search is the same for any number of elements of the list |
A simple performance optimisation is to locate the values requested more frequently at the start of the list to minimise iterations.