Year 9 (ages 13–14, Grade 8 in the US) · Computing · Algorithms · Lesson 2
Binary search
How binary search works on a sorted list, finding the middle, tracing searches, and comparing efficiency with linear search.
Exam boards: this lesson matches the AQA and Pearson Edexcel GCSE computing courses. Check which course your school follows.

22-minute video lesson
Teaching, worked examples and 20 practice questions solved step by step.
Watch free for a monthWhat your child will learn
- Describe binary search
- Trace a binary search
- Compare with linear search
- Explain why the list must be sorted
The method
- Check the list is sorted.
- Find the middle: (low + high) ÷ 2, rounded down.
- Compare; discard half.
- Repeat; count comparisons.
Key words: binary search, sorted, midpoint, comparison, efficiency.
Worked examples
Worked examples from the lesson, with every step.
Question 1
Use a binary search to find 16 in [2, 5, 8, 12, 16, 23, 38, 45, 56]. How many comparisons?
- Step 1: The list must be sorted
- Step 2: Check the middle
Answer: found at position 4 after 1 comparison
Question 2
Use a binary search to find 2 in [2, 5, 8, 12, 16, 23, 38, 45, 56]. How many comparisons?
- Step 1: The list must be sorted
- Step 2: Check the middle
- Step 3: Check the middle
- Step 4: Check the middle
Answer: found at position 0 after 3 comparisons
Question 3
Use a binary search to find 56 in [2, 5, 8, 12, 16, 23, 38, 45, 56]. How many comparisons?
- Step 1: The list must be sorted
- Step 2: Check the middle
- Step 3: Check the middle
- Step 4: Check the middle
- Step 5: Check the middle
Answer: found at position 8 after 4 comparisons