Exponential Search Algorithm

In computer science, an exponential search (also named doubling search or galloping search or Struzik search) is an algorithm, created by Jon Bentley and Andrew Chi-Chih Yao in 1976, for searching sorted, unbounded / infinite lists. exponential search can even out-perform more traditional searches for bounded lists, such as binary search, when the component being searched for is near the beginning of the array.

Exponential Search source code, pseudocode and analysis

If the component at the current index is larger than the search key, the algorithm now knows that the search key, if it is contained in the list at all, is located in the interval formed by the previous search index, 2j-1, and the current search index, 2j. exponential search lets for searching through a sorted, unbounded list for a specified input value (the search" key"). As such, the first phase of the algorithm takes O(logThe second part of the algorithm also takes O(log