¿Existe un Algoritmo mas rápido que la búsqueda binaria para procesar grandes cantidades de datos? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

¿Existe un Algoritmo mas rápido que la búsqueda binaria para procesar grandes cantidades de datos?

quisiera saber si alguien me puede orientar para potenciar el rendimiento de este algoritmo y así poder procesar mejor los datos con el objeto hacer mejores búsquedas y generar respuestas mas rápido a peticiones de usuario final. numeros = [1,2,3,4,5,6,7,8,9,10] import time tinicial = time.time() def busqueda(arreglo,item): inicio = 0 final = len(arreglo)-1 mitad = (inicio + final)// 2 while inicio <= final : if arreglo[mitad] == item: return True elif item < arreglo[mitad]: final = mitad - 1 else: inicio = mitad + 1 mitad = (inicio + final) // 2 return False tfinal = time.time() print(busqueda(numeros,40000000)) print(tfinal - tinicial)

16th Feb 2022, 3:58 AM
Gabriel contreras
Gabriel contreras - avatar
1 Answer
0
Supongo que con ciclos infinitos pero no sé eso aún jajaja
20th Apr 2022, 8:12 PM
EDUAWRD ABA. DE JES.
EDUAWRD ABA. DE JES. - avatar