The necessary condition for using binary search in an array is :-
2016
The necessary condition for using binary search in an array is :-
- A.
The array should not be too long
- B.
The array should of more size
- C.
The array should be sorted
- D.
None of these
Attempted by 406 students.
Show answer & explanation
Correct answer: C
Binary search is an efficient algorithm for finding a target value within a list. However, it relies on the assumption that the elements are arranged in order (sorted). If the array is not sorted, binary search cannot correctly eliminate half of the remaining elements at each step. Therefore, the necessary condition for using binary search is that the array must be sorted.
A video solution is available for this question — log in and enroll to watch it.