Seth.

Exponential Search

Exponential Search - Technical Overview

1. Algorithm Description: Exponential Search is an algorithm that finds the range where the target element may exist and performs a binary search within that range.

2. Steps of Exponential Search:

  • Start by checking the first element.
  • Exponentially increase the search range (1, 2, 4, 8, ...).
  • Once the range is found, perform a binary search within that range.
  • If the target is found, return its index; otherwise, return -1.

3. Time Complexity: O(log i), where i is the index of the target element (if present) and O(log n) for the binary search.

4. Space Complexity: O(1), as it operates in-place.

5. Stability: Exponential Search is not a stable search algorithm.

6. Usage: Useful for unbounded or infinite lists, or when searching in sorted arrays.