Linear Search Visualizer — Animated, Step-by-Step
Animated linear search with target input, step controls, speed, live comparison counter and pseudocode. Works on unsorted data. Runs in your browser.
Code examples
Ready-to-copy reference implementations. Free to use in your own projects and assignments.
How to use
- 1 Set a Target value to search for in the array.
- 2 Press Play to scan left-to-right, or Step through one comparison at a time.
- 3 Type your own numbers into Custom input and press Apply (order is preserved).
- 4 Follow the highlighted pseudocode and the cursor as it checks each element.
Why use this tool
- See the simplest search: check every element until the target is found.
- Understand why linear search is O(n) and works on unsorted data.
- Watch already-scanned elements dim as the cursor moves forward.
- Runs entirely in your browser. No signup, no uploads.
Frequently asked questions
What is linear search?
Linear search (sequential search) checks each element of a list in order until it finds the target or reaches the end.
What is the time complexity of linear search?
O(n) in the average and worst case — it may inspect every element. Best case is O(1) when the target is the first element.
Does linear search need sorted data?
No. Linear search works on any array, sorted or not. That flexibility is its main advantage over binary search.
When should I use linear search?
For small or unsorted datasets, or when the data is only searched once (sorting first would cost more than a single linear scan).
What is Linear Search Visualizer?
A Linear Search Visualizer animates sequential search: checking each element of an array in order until the target is found or the end is reached. It works on unsorted data and demonstrates the O(n) running time.
Features
Step-by-step animation
Watch each element get compared to the target in order.
Complexity
Time: O(n) (best O(1), worst O(n)). Space: O(1). Works on unsorted data.
100% private
Runs entirely in your browser — nothing is uploaded.
Example
Input
find 7 in [4, 2, 7, 1]
Output
check 4 → 2 → 7 → found at index 2
Common use cases
-
1
Search unsorted data
See the simplest search that needs no ordering.
-
2
Contrast with binary search
Compare O(n) scanning against O(log n) on sorted input.
-
3
Learn the baseline
Understand the linear baseline every faster search improves on.
Zerethon's linear search visualizer animates a sequential scan through an array in your browser, comparing each element to the target until a match is found or the array ends. Linear search runs in O(n) time (best O(1) if the target is first) with O(1) extra space, and works on unsorted data.
- Category
- Algorithm
- Pricing
- Free
- Privacy
- Browser-based
- Signup
- Not required
References
- MIT OCW 6.006 — Introduction to Algorithms (CLRS) — MIT OpenCourseWare
- Linear search — Wikipedia
Privacy
Your data never leaves your browser unless explicitly stated. Linear Search Visualizer runs entirely client-side — no server upload, no logging, no tracking of your input.
New to this? Read the step-by-step explanation with Big-O analysis: Learn Searching Algorithms →
Related tools
Binary Search Visualizer
Animated binary search over a sorted array with target input, step controls, speed, live comparison counter and pseudocode. Runs in your browser.
Open toolBubble Sort Visualizer
Animated bubble sort with step controls, speed, custom input, live comparison/swap counters and pseudocode. Runs entirely in your browser.
Open toolInsertion Sort Visualizer
Animated insertion sort with step controls, speed, custom input, live comparison/write counters and pseudocode. Runs in your browser.
Open toolSelection Sort Visualizer
Animated selection sort with step controls, speed, custom input, live comparison/swap counters and pseudocode. Runs in your browser.
Open toolBuild, share, and grow on Zerethon Social
Free signup. Earn points, collect achievements, and connect with creators worldwide.