ABSTRACT
Linear Search is the most fundamental searching algorithm. It works by inspecting every element in a list sequentially until the target is found or the end of the list is reached. Because it makes no assumptions about the order of the data, it is the only option for unsorted lists.
The Strategy
The algorithm follows a simple iterative logic:
- Iterate: While there are items remaining in the list:
- Inspect: Look at the current item.
- Match: Is this the item looking for?
- Yes → Return the position (Index).
- No → Move to the next item.
- Terminate: If you reach the end of the list without a match, report that the item is not found.

Proof of Correctness
Claim: Linear Search returns the index of the target if it exists, otherwise it returns a “not found” indicator.
- Base Case (): The list is empty. The loop condition is never met, and the algorithm correctly reports the item is not found.
- Inductive Step: Assume the algorithm correctly searches a list of size . For a list of size , the algorithm checks the first element. If it matches, it’s correct. If not, it recursively (or iteratively) searches the remaining elements. By the hypothesis, the search on the remaining elements is correct.
Time Analysis
On a list of length , the performance is measured by the number of comparisons:
1. Best Case ()
- Scenario: The target element is the first item in the list.
- Comparisons: 1.
2. Worst Case ()
- Scenario: The target element is the last item in the list or is not present at all.
- Comparisons: .
3. Average Case ()
- Scenario: The target is found somewhere in the middle.
- Comparisons: Approximately .

Pros and Cons
| Strengths | Weaknesses |
|---|---|
| Works on unsorted data. | Very slow for large datasets ( takes steps). |
| Simple to implement and requires no extra memory. | Inefficient compared to Binary Search for sorted data. |
Related Notes
- Linear Search vs Binary Search – Comparing asymptotic growth.
- Time Analysis – General rules for complexity.