PRACTICE / UNDERSTAND / REPEAT
Data Structures & Algorithms practice question
Practice binary search with self-contained questions. Check your answer, then use the explanation to understand the reasoning.
1 questionAnswers explainedFree · no login
Try this question
Binary search uses inclusive bounds low = 1 and high = 9. Using low + floor((high - low) / 2), what is mid?
Answer & explanation
Answer: 5
The difference is eight, so the midpoint is four positions above low.