python 递归查找
def search(data,find_n):
"递归数据二分查找法"
if data.count(find_n) >= 1:
mid=(len(data) / 2)
print data
if mid >= 0:
if data[mid] > find_n:
search(data[:mid],find_n)
elif data[mid] < find_n:
search(data[mid:],find_n)
elif data[mid] == find_n:
print 'fund is data',data[mid]
else:
print "cannot found"
else:
print 'found data has not the list '
if __name__ == '__main__':
data=list(range(10))
search(data,9)
生活就应该向往美好