Linear Search
The most fundamental search algorithm: checking every element in a sequence until the target is found or the end is reached.
Parameters
Visualization
Step: 0Algorithm Insight
Linear search examines each element in an array one by one in sequential order.
- 1. Start from the first element (index 0).
- 2. Compare current element with the Target.
- 3. If they match, search is successful!
- 4. Otherwise, move to the next element and repeat.
Efficiency
Overview
Linear search scans values from one end until it finds the target or reaches the end. It works on unsorted data without preprocessing, making it useful for small inputs or one-off searches; a missing target requires checking every element.