Let's use the array we used in jump search, {8, 15, 23, 28, 32, 39, 42, 44, 47, 48}, to perform an exponential search, and we will also find value 39. First, we apply setblockIndex = 1, then compare array[1] with the searched value, 39. Since 15 is lower than 39, the algorithm sets blockIndex = 2. array[2] is still lower than 39, then moves to array[4]. And since its value is still lower than 39, it moves to array[8] and finds that it's now greater than 39. After that, the algorithm performs the binary search from array[4] to array[8] to find the searched value. The implementation of the exponent search in C++ will be as follows:
int ExponentialSearch( int arr[], int arrSize, int val){ // It's impossible ...