Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
binary search
#python 3.5.2 def binsearch(value): low=0 high=len(A)-1 while low<high: mid=int((low+high)/2)# calculating mid point certain part of array if A[mid]<value: low=mid+1 elif A[mid]>value: high=mid-1 elif A[mid]==value: return mid A=[10,20,30,40,50,60,70,80,90] value=80 #the value to be searched search=binsearch(value) if search!=None: print ("element is found at index",search) else: print ("element is not found ")
run
|
edit
|
history
|
help
0
Distance between latititude and longitude
max/min fuction
Celcius to Fahrenheit
Lcm and hcf
Подсчет функции
pyCustomEnum
shuru5
Ortalama
ASICC art
PyWeekD