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 678dedb commit 4741115Copy full SHA for 4741115
1 file changed
searches/binary_search.py
@@ -3,13 +3,20 @@
3
"""
4
Pure Python implementations of binary search algorithms
5
6
+Basic Idea:
7
+Binary Search works by repeatedly dividing the search interval in half.
8
+If the target value is smaller than the middle element, the search continues
9
+in the left half. Otherwise, it continues in the right half.
10
+This process repeats until the element is found or the interval becomes empty.
11
+
12
For doctests run the following command:
13
python3 -m doctest -v binary_search.py
14
15
For manual testing run:
16
python3 binary_search.py
17
18
19
20
from __future__ import annotations
21
22
import bisect
0 commit comments