It's because if the array or list has the elements unsorted, then we need to sort it first. So the sort time complexity is O(nlogn) and then we use a binary search which takes O(logn). Overall it takes O(nlogn) for unsorted array or list.

If the array given is a sorted array then the search time complexity is definitely O(logn).

Read more… (60 words)