zcgw.net
当前位置:首页 >> BinAry sEArCh python >>

BinAry sEArCh python

class binarynode: def __init__(self,data,left=None,right=None): self._data=data self._left=left self._right=rightclass binarysearchtree : def __init__(self): self._root=None def insert(self,data): if self._root is None: self._r...

def binary_search(A,value): len_A=len(A) mid_i = len_A/2 if mid_i==0: return A[mid_i] if A[mid_i]>value: binary_search(A[0:mid_i],value) else: binary_search(A[mid_i:len_A],value) if __name__=='__main__': a=[5,2,4,6,1,3] a.sort(...

网站首页 | 网站地图
All rights reserved Powered by www.zcgw.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com