Skip to content

Concept module

Binary Search / Halving the Search Space

Keep an ordered list, the low-mid-high markers, and the shrinking interval visible together so binary search feels visual instead of procedural.

The simulation shows an ordered array with low, mid, and high markers. The active interval stays highlighted, and an optional ghost lane shows how far a one-by-one scan would have progressed by the same number of checks. Binary search is looking for 34 inside an ordered list of 14 values. It has used 0 midpoint checks so far. The live interval spans 0 to 13, so only 14 positions still matter. A left-to-right scan would still need 11 checks to guarantee the same target.

Interactive lab

Keep the stage, graph, and immediate control feedback in one working view.

Time

0.00 s / 2.16 sLivePause to inspect a specific moment, then step or scrub through it.
0.00 s2.16 s

Algorithms and search

Keep the ordered list, the low-mid-high markers, and the shrinking live interval visible together so halving the search space feels concrete.

Live searchTarget 34 in 14 ordered valueschecks 040711021331641952262572883193410371140124313lowmidhightargetLinear contrastOne-by-one scanning reaches the target much more slowlychecks 040711021331641952262572883193410371140124313startBinary-search readoutLivetarget34checks0interval14linear need11advantage11foundnot yetBinary search readyBinary search starts with the whole ordered array, then keeps halving the live interval.The ghost lane shows how far a one-by-one scan would have reached by the same step count.

Graphs

Switch graph views without breaking the live stage and time link.

Interval width over time

One graph tracks the interval width, another tracks the low-mid-high positions, and a third compares binary-search checks with linear-search checks.

time: -0.17 to 2.33positions left: 6.44 to 14.56
interval width
Interval width over timeOne graph tracks the interval width, another tracks the low-mid-high positions, and a third compares binary-search checks with linear-search checks.-0.170.451.081.712.336.448.4710.512.5314.56timepositions left
Hover or scrub to link the graph back to the stage.time / positions left

Controls

Adjust the live parameters and watch the bench respond.

14
10

Presets

Predict -> manipulate -> observe

Keep the active prompt next to the controls so each change has an immediate visible consequence.

ObservationPrompt 1 of 2
The important move is not a faster scan. It is the midpoint deleting half of the remaining interval at once.

Equation map

See each variable before you move it.

Select a symbol to highlight the matching control and the graph or overlay it most directly changes.

Array size
14

Sets how many ordered values the search has to work through.

Graph: Interval width over timeGraph: Binary versus linear checksOverlay: Active intervalOverlay: Low-mid-high markers

Equations in play

Choose an equation to sync the active symbol, control highlight, and related graph mapping.

More tools

Detailed noticing prompts, guided overlays, and challenge tasks stay available without taking over the main bench.

Hide

What to notice

Keep the ordered list and one history graph visible together.

ObservationPrompt 1 of 2
Graph: Interval width over time
The important move is not a faster scan. It is the midpoint deleting half of the remaining interval at once.
Control: Target positionControl: Array sizeGraph: Interval width over timeGraph: Low, mid, and highOverlay: Active intervalOverlay: Low-mid-high markersEquationEquation

Guided overlays

Focus one overlay at a time to see what it represents and what to notice in the live motion.

2 visible

Overlay focus

Active interval

Highlight the part of the ordered list that is still alive.

What to notice

  • Each midpoint comparison can delete half the list at once.

Why it matters

It turns the efficiency of binary search into something visible.

Control: Array sizeControl: Target positionGraph: Interval width over timeGraph: Low, mid, and highEquationEquation

Challenge mode

Make halving the search space do real work.

0/1 solved
ConditionCore

3 of 7 checks

Find a far-right target fast

Build a large ordered list where the target sits near the far-right edge, but binary search still finds it in five checks or fewer.
Graph-linkedGuided start
Pending
Open the Binary versus linear checks graph.
Interval width over time
Matched
Keep the Active interval visible.
On
Matched
Keep the Low-mid-high markers visible.
On
Pending
Keep array size between 18 and 20.
14
Pending
Keep target index between 15 and 19.
10
Pending
Keep found between 1 and 1.
0
Matched
Keep comparisons between 0 and 5.
0

The checklist updates from the live simulation state, active graph, overlays, inspect time, and compare setup.

Binary search is looking for 34 inside an ordered list of 14 values. It has used 0 midpoint checks so far. The live interval spans 0 to 13, so only 14 positions still matter. A left-to-right scan would still need 11 checks to guarantee the same target.
Equation detailsDeeper interpretation, notes, and worked variable context.

Midpoint rule

Chooses the next index to inspect from the current live interval.

Target position 10

Interval width

Counts how many positions are still alive after each halving step.

Array size 14 Target position 10 Linear contrast On

Progress

Not startedMastery: NewLocal-first

Start exploring and Open Model Lab will keep this concept's progress on this browser first. Challenge mode has 1 compact task ready. No finished quick test, solved challenge, or completion mark is saved yet.

Let the live model runChange one real controlOpen What to notice

Try this setup

Jump to a named bench state or copy the one you are looking at now. Shared links reopen the same controls, graph, overlays, and compare context.

Saved setups

Premium keeps named exact-state study setups in your account while stable concept links stay public below.

Checking saved setup access.

This concept can keep using stable links while the saved-setups capability resolves for this browser.

Copy current setup

Stable concept and section links stay public below while exact-state setup sharing stays behind premium.

Stable links

Starter track

Step 2 of 20 / 2 complete

Algorithms and Search Foundations

Earlier steps still set up Binary Search / Halving the Search Space.

1. Sorting and Algorithmic Trade-offs2. Binary Search / Halving the Search Space

Previous step: Sorting and Algorithmic Trade-offs.

Short explanation

What the system is doing

Binary search only makes sense on ordered data. Once the list is ordered, each midpoint check can delete half of the remaining possibilities instead of checking one item after another.

This bench keeps low, mid, high, and the shrinking interval visible together so the speed comes from the geometry of the search space, not from memorizing a procedure.

Key ideas

01Binary search works because the data is ordered.
02The midpoint matters because one comparison can remove half of the remaining interval.
03Low, mid, and high define the live search space.

Worked example

Read the full frozen walkthrough.

Frozen walkthrough
Read the current interval directly from the live search scene.

Live worked examples are available on Premium. You can still read the full frozen walkthrough on the free tier.

View plans
Frozen valuesUsing frozen parameters

What does the current binary-search step tell you right now?

Array size

14

Target position

10

1. Read the live interval

The active interval runs from index 0 to 13, so 14 positions are still possible.

2. Read the midpoint check

The current midpoint is index 6, which holds 22 while the target is 34.

3. Compare the search cost

So far binary search has used 0 midpoint checks, while a one-by-one scan would need 11 checks to guarantee the same target.

Current search read

Because the target is larger than the midpoint value, the left half is already ruled out.

Common misconception

Binary search is just a faster way of checking one item at a time.

The point is not a slightly better scan. The point is halving the remaining possibilities after each midpoint check.

That only works because the list is already ordered.

Mini challenge

Build a case where the target is near the far edge of a large list but binary search still reaches it in only a few midpoint checks.

Prediction prompt

Decide whether the target should sit near the middle or near an edge before you change the controls.

Check your reasoning

Put the target near an edge in a large list, then let halving do the work.
Even a far-away target can be found quickly once the interval keeps shrinking by halves.

Quick test

Reasoning

Question 1 of 2

Answer from the live search picture, not from memorized vocabulary.

Why does binary search need ordered data?

Choose one answer to reveal feedback, then test the idea in the live system if a guided example is available.

Accessible description

The simulation shows an ordered array with low, mid, and high markers. The active interval stays highlighted, and an optional ghost lane shows how far a one-by-one scan would have progressed by the same number of checks.

Graph summary

One graph tracks the interval width, another tracks the low-mid-high positions, and a third compares binary-search checks with linear-search checks.