In computer science, jump search is a search algorithm for sorted array which find the element by jumping ahead by fixed steps or skipping some elements in place of searching all elements.
pip install allalgorithms
from allalgorithms.searches import jump_search
arr = [-2, 1, 2, 7, 10, 77]
print(jump_search(arr, 7))
# -> 3
print(jump_search(arr, 3))
# -> None
Return array index if its found, otherwise returns
None
arr
: Sorted Arrayquery
: Element to search for in the array