Closed
Description
Checking for non-sorted input is an O(n) operation. Performing the actual binary search is O(log(n)). Forcing the inclusion of an O(n) operation in the implementation of an O(log(n)) algorithm is confusing.
If you don't know that your input is sorted, there's no point in doing a binary search (sorting or checking for sorted input takes at least as long as a linear search), so I think this requirement should be removed.
Metadata
Metadata
Assignees
Labels
No labels