Binary search is performed on a sorted array of n elements. The search key is not in the array and falls between the elements at positions m and m+1 (where 1 ≤ m
Binary search is performed on a sorted array of n elements. The search key is not in the array and falls between the elements at positions m and m+1 (where 1 ≤ m
Related questions
Question

Transcribed Image Text:Binary search is performed on a sorted array of n elements. The search key is not in the array and falls
between the elements at positions m and m+1 (where 1 ≤ m <n). How many comparisons are needed in
the worst case scenario to determine that the key is not in the array?
a. ceil(log(n))
b. floor(log(n))
c. ceil(log(m))
d. floor(log(m))
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps
