File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 55from __future__ import annotations
66
77import math
8- from typing import Any , Protocol , TypeVar
8+ from typing import Any , Protocol
99
1010class Comparable (Protocol ):
1111 def __lt__ (self , other : Any , / ) -> bool : ...
1212
13- T = TypeVar ("T" , bound = Comparable )
14-
15- def jump_search (arr : list [T ], item : T ) -> int :
13+ def jump_search [T : Comparable ](arr : list [T ], item : T ) -> int :
1614 """
1715 Python implementation of the jump search algorithm.
1816 Return the index if the `item` is found, otherwise return -1.
@@ -63,4 +61,5 @@ def jump_search(arr: list[T], item: T) -> int:
6361 if res == - 1 :
6462 print ("Number not found!" )
6563 else :
66- print (f"Number { search_item } is at index { res } " )
64+ print (f"Number { search_item } is at index { res } " )
65+
You can’t perform that action at this time.
0 commit comments