Binary Search Preconditions
Data must be sorted or otherwise monotonically ordered.
The comparison must be consistent with that ordering.
Random access is important for efficient array-based binary search.
Time complexity is O(log n).
Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.