Which of the following is true for binary search algorithm :-
1.Array should be in unsorted order
2.Search is performed by repetedly dividing search interval into one fourth
3.If there are two numbers equals to the search item ( number to be searched ), it can pick anyone depending on the implementation
4.Its best case complexity is O(log n)
enter reason here
Answers
Answer:
koi reason v bta do I know ans but I donno reason
Answer:
Correct option is 3) If there are two numbers that are equal to the search item, it can pick any one of those depending on the implementation.
Explanation:
A binary search algorithm is an alternative to linear/sequential search algorithm.
It is much faster that linear search.
The time complexity of binary search is O(log n) in worst case. It is O(1)) is the best case.
One essential condition to perform this searching algorithm is that the array needs to be sorted prior to performing this algorithm.
Search is performed by repeatedly dividing the array into 2 halves and then performing the algorithm in these parts and so on.
If there are two numbers that are equal to the search item, it can pick any one of those depending on the implementation. This is the correct option.