Commit 29203fda by BellCodeEditor

save project

parent 666d083a
Showing with 3 additions and 1 deletions
......@@ -9,7 +9,7 @@ num = random.choice(alist)
def binary_search(alist,num):
low = 0
high = len(alist) -1
while low < high:
while low <= high:
mid = (low +high) //2
gu = alist[mid]
if gu == num:
......@@ -20,4 +20,5 @@ def binary_search(alist,num):
high = mid -1
else:
return None
print(num)
print(binary_search(alist,num))
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment