Skip to content

Commit 2471319

Browse files
committed
re-coded bisect
1 parent 1120fb1 commit 2471319

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

names/names.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
1-
from bisect import bisect_left
21
import time
32

43

4+
def bisect_left(a, x, lo=0, hi=None):
5+
if hi is None:
6+
hi = len(a)
7+
while lo < hi:
8+
mid = (lo+hi)//2
9+
if a[mid] < x:
10+
lo = mid+1
11+
else:
12+
hi = mid
13+
return lo
14+
15+
516
class BinarySearchTree:
617
def __init__(self, value):
718
self.value = value

0 commit comments

Comments
 (0)