diff --git a/Code/BinarySearch.py b/Code/BinarySearch.py index 9922b4b..a989c67 100644 --- a/Code/BinarySearch.py +++ b/Code/BinarySearch.py @@ -2,7 +2,7 @@ def BinarySearch(array, low, high, find): while low <= high: - mid = low + (high - low)//2; + mid =(low + high)//2 if array[mid] == find: @@ -27,8 +27,8 @@ def BinarySearch(array, low, high, find): found = BinarySearch(arr, 0, len(arr)-1, find) -if found != -1: - print ("Given element %d is found at index %d" %(find, found)) +if found!=-1: #If value of found is not -1 it will execute + print ("Given element %d is found at index %d" %(find, found) else: print ("Given element is not present in the given array")