Lessons
C++ · Searching and Sorting · 35. Binary Search
step 1 of 6
Open the middle
In a sorted list I look at the middle. Too small? The answer is to the right. Too big? To the left.
Each look throws half the list away. That's binary search.
Mission
Make me look for 50. Watch which cells I look at.
PIP·1
main.cppyour code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
← press me!
Press RUN to see what this program does.