Jump search is a slightly modified version of linear search. Instead of searching each index, we jump a few indexes by a fixed number of steps. There is no rule on how many steps we should skip in every iteration.
Let's consider an example to understand this better. Imagine that we've a large array of [1, 5, 7, 12, 18, 25, 37, 49, 62, 73, 89, 103, ........] and we want to search for a number (62 here). We'll perform the following steps:
- Check if the value at index 0 (1 here) is equal to x (62 here).
- If yes, the search is complete.
- If no, jump to index 5 (25 here) and check whether the value is equal to x (62). We skipped 5 indexes here.
- There might be many cases where the number might not be present in the array or list. In those cases, we need to stop the search operation as soon as possible. So repeat step 3 until we find a number equal to or greater...