What is the primary criterion of performing binary search technique on a list of data?
Answers
Answer✔️✔️✔️
1) The elements are in an array (or in any data structure that enables indexed access). 2) The storage is sorted according to the compare function.
The primary criterion for performing binary search on a list of data is that the list must be sorted in ascending or descending order.
Binary search is a divide-and-conquer algorithm that repeatedly divides the search interval in half until the target value is found or determined to be not in the list.
In order for binary search to work correctly, it relies on the fact that the list is sorted.
If the list is not sorted, binary search may not be able to correctly locate the target value, and may return incorrect results.
Therefore, sorting the list is a necessary precondition for using binary search.
For similar question on Binary technique.
https://brainly.in/question/18308220
#SPJ3