Last active
November 2, 2021 19:35
-
-
Save salluzziluca/ef011b21070730266281b2cc7467edf9 to your computer and use it in GitHub Desktop.
Busqueda linea, secuencial o por fuerza bruta
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def busqueda_lineal(lista, item): | |
largo=len(lista) | |
encontrado = False | |
i = 0 | |
while i < largo and encontrado == False: | |
if lista[i]==item: | |
posicion =i | |
encontrado = True | |
i+=1 | |
return posicion |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment