Skip to content

Commit f16b1d2

Browse files
Refactor docstrings for lower_bound and upper_bound
Updated docstring parameter and return type annotations for lower_bound and upper_bound functions.
1 parent 58ad165 commit f16b1d2

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

searches/binary_search.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,9 @@ def lower_bound(sorted_collection: list[int], item: int) -> int:
276276
"""
277277
Returns the index of the first element greater than or equal to the item.
278278
279-
Args:
280-
sorted_collection: The sorted list to search.
281-
item: The item to find the lower bound for.
282-
283-
Returns:
284-
int: The index where the item can be inserted while maintaining order.
279+
:param sorted_collection: The sorted list to search.
280+
:param item: The item to find the lower bound for.
281+
:return: The index where the item can be inserted while maintaining order.
285282
"""
286283
left = 0
287284
right = len(sorted_collection)
@@ -298,12 +295,9 @@ def upper_bound(sorted_collection: list[int], item: int) -> int:
298295
"""
299296
Returns the index of the first element strictly greater than the item.
300297
301-
Args:
302-
sorted_collection: The sorted list to search.
303-
item: The item to find the upper bound for.
304-
305-
Returns:
306-
int: The index where the item can be inserted after all existing instances.
298+
:param sorted_collection: The sorted list to search.
299+
:param item: The item to find the upper bound for.
300+
:return: The index where the item can be inserted after all existing instances.
307301
"""
308302
left = 0
309303
right = len(sorted_collection)

0 commit comments

Comments
 (0)