Given an array X = (22, 33, 55, 88, 96) and key = 88. How many iterations are…
2023
Given an array X = (22, 33, 55, 88, 96) and key = 88. How many iterations are required to find the key using binary search?
- A.
3
- B.
2
- C.
1
- D.
4
Attempted by 106 students.
Show answer & explanation
Correct answer: B
Binary search first checks the middle value 55, then searches the right half and checks 88. The key is found in 2 iterations.