Finding things Quickly IV: Binary Search versus Sequential Search
Binary Search of a file with n records takes O(log2n) comparisons.
Sequential search takes O(n) comparisons.
When sequential search is used, doubling the number of records in the file doubles the number of comparisons required for sequential search.
When binary search is used, doubling the number of records in the file only adds one more guess to our worst case.
In order to use binary search, though, the file first has to be sorted. This can be very expensive.