Test yourself on Binary Search with exam style questions, marked instantly.
Flashcards that come back just before you would forget them.
A revision plan that remembers what you know and shows what to do next.
See which topics you have nailed and which need another look.
Quiz yourself on Binary SearchGet your flashcardsBuild my revision planTrack my progressDeep Dive: Worked Example
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.
Make this stick
Signing in gives access to all PrepWise features.