Ages 16–18 · A Level · Growing
Binary search with duplicate keys
Use the evidence in binary search with duplicate keys to select and justify a valid solution.
Understand the idea
Complexity describes growth with input size rather than one timing result.
Your challenge
A binary search finds one occurrence of key 7 in sorted [2,7,7,7,9]. The API promises the first occurrence. What additional action is needed after a match?
- Return immediately from any matching midpoint
- Search only to the right for the first occurrence
- Continue searching the left candidate range while remembering the match
How to explore
- Distinguish finding an occurrence from proving it is the earliest.
- Compare each proposed response with the complete observation or trace, rather than with only one familiar word.
- Check the selected response against the complete situation, including a case where a tempting alternative fails.
Open the activity to work with its controls and check your reasoning. Progress stays in this browser.
Keep exploring
DON’T LET THE QUESTION END HEREGive that curiosity
Open the learning space