dedicated visualizer
Linear Search
Checks each value in sequence until a match is found or the array ends. This page keeps the runner, chart, and controls focused on a single algorithm so the walkthrough feels calmer than the overview page.
session controls
Compare this algorithm against a related one, turn on quiz mode, or keep the current state in a shareable URL.
current shareable URL
Copy the URL to preserve this exact dataset, target, compare mode, and quiz state.
browse more
Want a different problem or visual mode? Jump back to the catalog and open another dedicated page.
open catalogscenario presets
Load a focused input that reveals a specific behavior quickly instead of hand-editing every value first.
dataset controls
Use your own array, randomize a fresh one, or restore defaults. The same dataset is shared by both panels in compare mode.
Enter up to 12 integers. Values are normalized to the range 1–99 for clean visualization.
chart + counters
The visualization and the live counters stay together so each step is easier to read.
current action · start scan
current action
start scan
comparisons
0
final 6
current index
—
final 5
steps
1 / 8
index 0
14
still in search range
index 1
3
still in search range
index 2
28
still in search range
index 3
9
still in search range
index 4
41
still in search range
index 5
18
still in search range
index 6
7
still in search range
index 7
25
still in search range
run summary
Finished in 8 steps. 18 is found at index 5.
comparisons
6
current index
5
steps
8
current explanation
Linear search will check each value in order until it finds 18.
simple explanation
Start at the first value and inspect them one by one.
pseudocode
complexity card
best
O(1)
average
O(n)
worst
O(n)
space
O(1)
algorithm notes
intuition
Linear search trades speed for simplicity by never assuming anything about the data.
tradeoffs
- Works on unsorted input.
- No setup cost.
- Slow on large datasets.
when to use it
Use for tiny datasets, streaming data, or one-off checks on unsorted collections.
interview tips
- Use it as the baseline when comparing against binary search.
- Mention that it is the only choice if the data is unsorted and cannot be preprocessed.
what I learned building this
typed definitions
One algorithm schema now drives the catalog, counters, pseudocode, notes, and visual modes, which keeps the UI consistent as the lab grows.
replay over mutation
Precomputed steps made it much easier to synchronize explanations, metrics, quiz prompts, and scrubber playback without hidden state drifting out of sync.
portfolio framing
Shareable URL state, compare mode, and responsive layouts mattered as much as the algorithm logic because this page needs to teach clearly and still feel polished as a product.
more in this lane
Want a different take on the same problem family? These stay in the same category but change the strategy.