Skip to content

Latest commit

 

History

History
 
 

binarySearchTemplate

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

二分查找模板

模板地址

模板

left, right = 0, len(array) - 1
while left <= right:
    mid = (left + rigth) / 2
    if array[mid] == target:
        # find the target
        break or return result
    elif array[mid] < target:
        left = mid + 1
    else:
        right = mid - 1