Find 23 in [2, 5, 8, 12, 16, 23, 38] (positions 0 to 6):
| Step | Low | High | Midpoint | Middle item | Decision |
|---|---|---|---|---|---|
| 1 | 0 | 6 | 3 | 12 | 23 is bigger, keep the right half |
| 2 | 4 | 6 | 5 | 23 | Equal: found at position 5 |
Only two items were checked. A linear search would have checked six.
Searching for 10 in the same list: low 0, high 6, mid 3 (12) so high becomes 2. Mid 1 (5) so low becomes 2. Mid 2 (8) so low becomes 3. Now low (3) is greater than high (2), so 10 is not found.
This study notes covers Deep Dive: Worked Example within Binary Search for GCSE Computer Science. Revise Binary Search in 3.1 Fundamentals of Algorithms for GCSE Computer Science with 15 exam-style questions and 10 flashcards. This is a high-frequency topic, so it is worth revising until the explanation feels precise and repeatable. It is section 4 of 8 in this topic. Use this study notes to connect the idea to the wider topic before moving on to questions and flashcards.
Practice questions for Binary Search
Which of the following is a requirement before binary search can be used?
Describe how a binary search algorithm finds a target value in a sorted list.