worse case time complexity for binary search

528 Views Asked by At

It is known that binary search takes t units of time in the worst case for a sorted array of size n. How long will the algorithm take in the worst case if input size is n/2?

1

There are 1 best solutions below

0
On

Our new input differs from the original input by a factor of 2. Because the worst-case time of binary search is known to have a logarithmic complexity, the asymptotic upper bound on the time should be the same. This should hold true for any input that's a multiple of 2 of the original.