A0A Lecture4U
A0A Lecture4U
In the best case, the item X is the middle in the array A. A constant
number of comparisons (actually just 1) are required.
In the worst case, the item X does not exist in the array A at all. Through
each recursion or iteration of Binary Search, the size of the admissible
range is halved. In other words, the search space in Binary search is
divided in half during each iteration until the target element is found or
the search space is exhausted.