Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def busca_binaria(vetor, alvo):
- min = 0
- max = len(vetor) - 1
- mid = (max+min) // 2
- ## desenvolver o restante
- ## testando
- lista = [5, 89, 52, 11, 22]
- lista.sort() # ordena de forma crescente
- print(busca_binaria(lista, 52)) # resultado: 3 [indice]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement