Halo guys❤
State condition(s) under which BINARY SEARCH is applicable.
Answers
Answered by
7
Binary search works only on a sorted set of elements. To use binary search on a collection, the collection must first be sorted. When binary search is used to perform operations on a sorted set, the number of iterations can always be reduced on the basis of the value that is being searched.
in easy way →
the best way is to sort the array either in ascending or descending order
hope it helps you
Answered by
4
Explanation:
The preconditions are: There must be a way to compare any two elements of the array and get that either first is smaller, second is smaller or they are equal. This result must be deterministic, in the sense that if you compare them once again the results must be the same.
Similar questions
Math,
6 months ago
Math,
6 months ago
English,
6 months ago
Social Sciences,
11 months ago
Chemistry,
1 year ago