Skip to content

Commit d308b35

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 3c96273 commit d308b35

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

searches/jump_search.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22
"""
33
Pure Python implementation of the jump search algorithm.
44
"""
5+
56
from __future__ import annotations
67

78
import math
89
from typing import Any, Protocol
910

11+
1012
class Comparable(Protocol):
1113
def __lt__(self, other: Any, /) -> bool: ...
1214

15+
1316
def jump_search[T: Comparable](arr: list[T], item: T) -> int:
1417
"""
1518
Python implementation of the jump search algorithm.
@@ -49,6 +52,7 @@ def jump_search[T: Comparable](arr: list[T], item: T) -> int:
4952
return prev
5053
return -1
5154

55+
5256
if __name__ == "__main__":
5357
import doctest
5458

@@ -62,4 +66,3 @@ def jump_search[T: Comparable](arr: list[T], item: T) -> int:
6266
print("Number not found!")
6367
else:
6468
print(f"Number {search_item} is at index {res}")
65-

0 commit comments

Comments
 (0)