April 2018
Intermediate to advanced
322 pages
6h 57m
English
Suppose we have an array containing {8, 15, 23, 28, 32, 39, 42, 44, 47, 48} elements, and we want to find the position of value 39. We will set the jump step by the square root elements number. Since the element number of the array is 10, the step will be √10 = 3. We will now compare the value of index 0, 3, 6, and 9. When the algorithm compares array[0] with 39, the value of array[0] is lower than the searched value. It then jumps to array[3] and compares its value with 39. Since the value is lower than the searched value, it jumps to array[6] and finds that 42 is greater than 39. It then jumps backward to array[6], and performs the linear search on array[6], array[7], and array[8] to find the value 39 and ...