We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 678dedb commit 5438db2Copy full SHA for 5438db2
searches/jump_search.py
@@ -1,11 +1,16 @@
1
"""
2
-Pure Python implementation of the jump search algorithm.
3
-This algorithm iterates through a sorted collection with a step of n^(1/2),
4
-until the element compared is bigger than the one searched.
5
-It will then perform a linear search until it matches the wanted number.
6
-If not found, it returns -1.
+Jump Search Algorithm
7
8
-https://en.wikipedia.org/wiki/Jump_search
+Jump Search works on sorted arrays by jumping ahead by fixed steps
+instead of checking every element sequentially.
+
+Time Complexity:
+Best case: O(1)
9
+Average case: O(√n)
10
+Worst case: O(√n)
11
12
+Space Complexity:
13
+O(1)
14
15
16
import math
0 commit comments