Answer:
3 comparisons
Step-by-step explanation:
Given:
Required
Determine the number of comparisons to get to 101
The length of the list is 8. So, the first index is 0 and the last is 7.
We have:
Initially:
-- first index
--- last index
Start by calculating the mid-item
--- approximated.
The mid-index is 4 and the item is:
101 is on the right of 48.
So, we calculate the new begin index.
Calculate mid
The mid-index is 6 and the item is:
101 is on the right of 100.
So, we calculate the new begin index.
Calculate mid
At this point, the mid-index is at 101
i.e.
This implies that, we have located 101.
So far, we made 3 comparisons