From 56bba980af96ff95e3461c5599ef6c4a0d29e628 Mon Sep 17 00:00:00 2001 From: UtkarshPrakash <48208181+UtkarshPrakash@users.noreply.github.com> Date: Sat, 26 Oct 2019 12:08:14 +0530 Subject: [PATCH] Update 16123004.py --- Binary Search/16123004.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/Binary Search/16123004.py b/Binary Search/16123004.py index c2eabcf..69f683f 100644 --- a/Binary Search/16123004.py +++ b/Binary Search/16123004.py @@ -1,7 +1,22 @@ -l = [ 2,3,4,5,6,8] - -n = len(l) -for i in n: - # TODO Fill Code here +def Binary_search(arr,start_index,last_index,element): + while (start_index<= last_index): + mid =(int)(start_index+last_index)/2 + if (element>arr[mid]): + start_index = mid+1 + elif (element