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
self
single_digit
Atur cara mengira luas permukaan dan isipadu sebuah trapezium
linked_lists
PYTHON 3 ÖDEV :)
variables.py
abc python basic
FizzBuzz
Like.C.M.
Hi.py