Skip to content

Commit bfc2031

Browse files
Cosmatic change
Cosmatic change
1 parent 0931f46 commit bfc2031

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Searching/Searching.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ def Binarysearch(self, arr, size, value):
4242
high = size - 1
4343

4444
while low <= high:
45-
mid = low + (high - low) / 2
46-
# To avoid the overflow
45+
mid = (low + high) / 2
4746
if arr[mid] == value:
4847
return True
4948
elif arr[mid] < value:
@@ -59,8 +58,7 @@ def BinarySearchRecursive(self, arr, value):
5958
def BinarySearchRecursiveUtil(self, arr, low, high, value):
6059
if low > high:
6160
return False
62-
mid = low + (high - low) / 2
63-
# To avoid the overflow
61+
mid = (low + high) / 2
6462
if arr[mid] == value:
6563
return True
6664
elif arr[mid] < value:

0 commit comments

Comments
 (0)