Binary search

Back to Algorithms

Let , and such that

Given such that , the problem is to find using only evaluations of .

This problem can be solved with the exponential binary search in time. If in addition is given such that , then this simplified problem can be solved with the binary search algorithm in time, where is the time taken by a single evaluation of .

If the search interval is bounded (i.e. is given), then the exponential binary search is not always faster than the binary search; at worst the exponential binary search uses twice as many comparisons as the binary search; see the notes for details.

References

An almost optimal algorithm for unbounded searching, Jon Louis Bentley, Andrew Chi-Chic Yao, Information Processing Letters, Volume 5, Issue 3, August 1976, pp. 82-87.

Learn more

Files

Binary search

Binary search module

Exponential binary search

Exponential binary search module

Testing for binary search