Skip to main contentSkip to solution

Assume a list =[2, 4, 6, 8, 10, 12, 14]

How many comparisons are required to find element '4' in the list using Binary search?

Solution

✅ Correct Option: 3

Binary search compares the target with the middle element and discards half the list each time, using mid=⌊low+high2⌋mid = \left\lfloor \dfrac{low + high}{2} \right\rfloor.

ComparisonlowhighmidElement at midResult
106384<84 < 8, search the left half
20214Found

Comparisons=2\text{Comparisons} = \boxed{2}

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question