Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some changes binary_search_algo.py #1053

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions python/binary_search_algo.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def binary_search(arr, item):
duration = 0

# Binary Searching
while low <= high:
while True:
duration += 1
mid = (low+high) // 2

Expand All @@ -18,10 +18,10 @@ def binary_search(arr, item):
return f"\n||| I found {item} at the {mid} index of the array |||\n# Duration : {duration}"
elif arr[mid] > item:
high = mid - 1
print(f"its lower than {arr[mid]}!")
print(f"It's lower than {arr[mid]}!")
else:
low = mid + 1
print(f"its bigger than {arr[mid]}!")
print(f"It's bigger than {arr[mid]}!")


# run the function
Expand Down