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 49be153 commit 58a27b7Copy full SHA for 58a27b7
searches/binary_search.py
@@ -183,6 +183,7 @@ def insort_right(
183
# It works by repeatedly dividing in half the portion of the list that could contain the item,
184
# until you've narrowed the possible locations to just one.
185
186
+
187
def binary_search(arr, x):
188
"""
189
Perform a binary search to find the element `x` in the sorted list `arr`.
@@ -213,6 +214,7 @@ def binary_search(arr, x):
213
214
# Return -1 if element is not present in the list
215
return -1
216
217
218
def binary_search_std_lib(sorted_collection: list[int], item: int) -> int:
219
"""Pure implementation of a binary search algorithm in Python using stdlib
220
0 commit comments