Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
binarySearch.py
#python 3.5.2 #binarySearch(list,key) def binarySearch(list,key): start=0 end=len(list)-1 found=0 while start<=end: mid=(start+end)//2 if list[mid]==key: found=1 break elif list[mid]>key: end=mid-1 else: start=mid+1 if found==1: print("Found @ ",mid) else: print("Not found") binarySearch([10,20,20,30,40,50,50,60],20)
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
adda
library
Select fruits
testpgm
abstractmethod 2
Game3
:progrm end
Game4
shiva
substring
Please log in to post a comment.