Skip to content
playdsa
Preferences

Make yourself comfortable.

Saved on this browser. Your device’s reduced-motion preference is always respected.

Theme
Advanced settings
Back to syllabus

Binary Search

6 chapters · 10 challenges · The Split Peaks

Understand the idea, practise through play, then prove it in code. Choose your next quest below.

Visual introduction to this topic
Start here · 3 minute mental model

What is binary search?

Binary search uses a yes-or-no comparison to discard an impossible half of an ordered search space. The search space can be array indices or every feasible answer to a constraint.

Think of guessing a page number. Open the book near the middle. If the page you want is later, the entire first half is no longer useful.

Every valid decision must remove a whole region, not just one candidate.

Order creates direction

A comparison must tell you which side can be discarded safely.

State the boundary

Decide whether low and high are possible answers before writing the loop.

Search the answer

A monotonic feasible/not-feasible rule can be searched even without a stored array.

What you will learn firstThe Split Peak Signal

Halve the only possible range

Begin the guided lesson

Your chapter route

The Split Peak Signal

Continue
Source reviewed

Built from authoritative material

This track is checked against the sources below. Visual traces still carry their own complete or guided coverage label, so unfinished explanations are not presented as complete executions.

Help shape PlayDSA

Something confusing, broken, or missing? Leave a quick note without leaving your lesson.

Please leave out passwords, payment details and other private information.

Page included: /

Sign in to save feedback here, or send it with your email app. Your draft stays here while you sign in.

Open email instead