917 B
917 B
title |
---|
Jump Search |
Jump Search
A jump search locates an item in a sorted array by jumping k itens and then verify if the item wanted is between the previous jump and current jump.
Complexity Worst Case
O(√N)
Works
- Define the value of k, the number of jump: Optimal jump size is √N where the N is the length of array
- Jump the array k-by-k searching by the condition
Array[i] < valueWanted < Array[i+k]
- Do a linear search between
Array[i]
andArray[i + k]
Code
To view examples of code implementation of this method access this link below:
Jump Search - OpenGenus/cosmos