This study notes covers Deep Dive: Binary Search Steps within Linear Search for GCSE Computer Science. Revise Linear Search in Algorithms for GCSE Computer Science with 15 exam-style questions and 8 flashcards. This topic appears less often, but it can still be a useful differentiator on mixed-topic papers. It is section 5 of 7 in this topic. Use this study notes to connect the idea to the wider topic before moving on to questions and flashcards.
Topic position
Section 5 of 7
Practice
15 questions
Recall
8 flashcards
Deep Dive: Binary Search Steps
To find 23 in [3, 7, 12, 23, 34, 45, 67]:
- Find middle: 23 (index 3)
- Compare: 23 == 23 ✓
- Found! Return index 3
To find 45:
- Middle: 23. Is 45 > 23? Yes. Look right half: [34, 45, 67]
- Middle: 45. Is 45 == 45? Yes!
- Found in 2 comparisons
Key formula: Maximum comparisons = log₂(n) + 1