Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def busca_binaria(lista, alvo):
- _min = 0
- _max = len(lista) - 1
- while _min <= _max:
- _mid = (_max + _min) // 2
- if lista[_mid] == alvo:
- return _mid
- elif lista[_mid] < alvo:
- _min = _mid + 1
- else:
- _max = _mid - 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement