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

icon
Related questions
Question
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))
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
steps

Step by step

Solved in 3 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS