Skip to content

Commit a1b12ac

Browse files
committed
fix: binary search first occurrence and resolve global ruff linting errors
1 parent 9fe6d31 commit a1b12ac

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

data_structures/hashing/hash_table_with_linked_list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def __init__(self, *args, **kwargs):
88
super().__init__(*args, **kwargs)
99

1010
def _set_value(self, key, data):
11-
self.values[key] = deque([]) if self.values[key] is None else self.values[key]
11+
self.values[key] = deque() if self.values[key] is None else self.values[key]
1212
self.values[key].appendleft(data)
1313
self._keys[key] = self.values[key]
1414

searches/binary_search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,4 +276,4 @@ def exponential_search(sorted_collection: list[int], item: int) -> int:
276276
timeit.timeit(
277277
f"{name}(collection, 500)", setup=setup, number=5_000, globals=globals()
278278
),
279-
)
279+
)

searches/jump_search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def __lt__(self, other: Any, /) -> bool: ...
2020
T = TypeVar("T", bound=Comparable)
2121

2222

23-
def jump_search(arr: Sequence[T], item: T) -> int:
23+
def jump_search[T](arr: Sequence[T], item: T) -> int:
2424
"""
2525
Python implementation of the jump search algorithm.
2626
Return the index if the `item` is found, otherwise return -1.

0 commit comments

Comments
 (0)