From 6c65781d05c0beff36b04e7180825c392cf7d3d9 Mon Sep 17 00:00:00 2001 From: parth-prog <72186550+parth-prog@users.noreply.github.com> Date: Thu, 1 Oct 2020 12:50:28 +0530 Subject: [PATCH] Update BinarySearch.py --- Code/BinarySearch.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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")