Time complexity and objective of binary search dsa
Answers
Answered by
0
With a binary search, you eliminate 1/2 the possible entries each iteration, such that at most it would only take 7 compares to find your value (log base 2 of 128 is 7 or 2 to the 7 power is 128.) This is the power of binary search. The time complexity of the binary search algorithm belongs to the O(log n) class.
Similar questions