Linear Search — Algorithm Visualizer

Step 1:Unsorted array. Searching for target: 35

Linear Search

Easy
Time Complexity
O(n²)O(n log n)O(n)O(log n)O(1)n →
Best: O(1)
Avg: O(n)
Worst: O(n)

Linear Search (or Sequential Search) is the simplest searching algorithm. It checks every element in the list sequentially until the target is found or the list is exhausted.

How it works:

1. Start from the first element
2. Compare each element with the target
3. If a match is found, return the index
4. If the end is reached without a match, return -1

Time Complexity:

Best: O(1) — target is the first element
Average: O(n)
Worst: O(n) — target is last or not present

Space Complexity: O(1)

Properties:

  • Works on unsorted arrays
  • No preprocessing needed
  • Simple to implement

Linear Search is useful for small datasets or unsorted data where more efficient algorithms cannot be applied.

Related algorithms

Frequently asked questions

What is Linear Search?
Linear Search (or Sequential Search) is the simplest searching algorithm. It checks every element in the list sequentially until the target is found or the list is exhausted.
What is the complexity of Linear Search?
Time (average): O(n) · Space: O(1)
Who is this Linear Search visualizer for?
The Linear Search visualization targets beginner-level learners in the Searching category. Useful for students, interview prep, and hands-on review.
What algorithms are related to Linear Search?
In the same category (Searching) you can explore: Binary Search, Jump Search, Interpolation Search. Each has an interactive visualization.