Searching arrays
Compare sequential inspection with halving a sorted interval.
Step forward, return to an earlier state, or scrub the timeline. Applying input begins a new run. Switching compatible algorithms retains the input; other algorithms load their own defaults.
Current state
Operation history
Pseudocode
Each highlighted line corresponds to an operation in the executable trace. Counts describe core algorithm work, excluding validation, snapshots, and rendering.
Read the executable JavaScriptExplore the lessons
- Linear search — Inspect items one at a time until the target appears.
- Binary search — Halve a sorted search interval after each comparison.
Follow the changing state
The data display shows each algorithm’s own variables and intermediate answers. Pink marks current work, amber marks dependencies or a divisor, and green marks a result. Each lesson explains its display, prerequisites, performance, and limitations.