Skip to content

Commit 90df653

Browse files
Merge pull request #1 from H-Darji/master
Minor improvement
2 parents b969226 + d44b888 commit 90df653

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: BinarySeach.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,18 @@ def binarySearch(alist, item):
99
midpoint = (first + last)//2
1010
if alist[midpoint] == item:
1111
found = True
12-
print("Found")
12+
print("Found [ at position: %s ]" % (alist.index(item) + 1))
1313
else:
1414

1515
if item < alist[midpoint]:
1616

1717
last = midpoint-1
1818
else:
1919
first = midpoint+1
20+
2021
if found == False:
21-
22-
print("Not found")
22+
continue
23+
# print("Not found")
2324
return found
2425
print("Enter numbers seprated by space")
2526
s = input()

0 commit comments

Comments
 (0)