If we have sorted array of 64 elements, what will be maximum number of comparisons required in binary search method to search for a particular element?
Answers
Answered by
0
Explanation:
time complexity or O(n) of Binary search is log n (base 2) as the "domain" halves after each comparison, so if you half a million 21 times you will reach 1 answer which will be the number you need. example: for 4 numbers in a binary search we will need at most 3 i.e log 4(base 2) + 1 =3
Similar questions