80.6k views
3 votes
Calculate how many guesses in binary search algorithm.

User Tom Lehman
by
3.8k points

1 Answer

5 votes

Answer:

In the case of a decimal number, we round down to find the actual number of guesses. Therefore, for a 1000-element array, binary search would require at most 10 guesses. (which is 2,097,152), so we would need at most 22 guesses.

Explanation:

User Naya
by
4.2k points