Skip to content

Commit 5b6ea4a

Browse files
authored
better name for variables
1 parent 85d8a56 commit 5b6ea4a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

coding/python/binary_search.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
target = random.randint(1, 50)
77

88

9-
def binary_search(li, le, ri, target):
10-
if le <= ri:
11-
mid = ri + le // 2
12-
if li[mid] == target:
9+
def binary_search(arr, lb, ub, target):
10+
if lb <= ub:
11+
mid = ub + lb // 2
12+
if arr[mid] == target:
1313
return mid
14-
elif li[mid] < target:
15-
return binary_search(li, mid + 1, ri, target)
14+
elif arr[mid] < target:
15+
return binary_search(arr, mid + 1, ub, target)
1616
else:
17-
return binary_search(li, le, mid - 1, target)
17+
return binary_search(arr, lb, mid - 1, target)
1818
else:
1919
return -1
2020

0 commit comments

Comments
 (0)