Podemos plantearnos también diseñar un algoritmo de búsqueda “ternaria”, que
primero compara con el elemento en posición n/3 del vector, si éste es menor que
el elemento x a buscar entonces compara con el elemento en posición 2n/3, y si no
coincide con x busca recursivamente en el correspondiente subvector de tamaño 1/3
del original. ¿Conseguimos así un algoritmo mejor que el de búsqueda binaria?
We may also consider designing a "ternary" search algorithm, which First compared to the element in position n / 3 of the vector, if this is less The element x to look for and compare with the element in position 2n / 3, and if not Match recursively searching for the corresponding 1/3 size subvector From the original. Did we get a better algorithm than binary search?
We may also consider designing a "ternary" search algorithm, which First compared to the element in position n / 3 of the vector, if this is less The element x to look for and compare with the element in position 2n / 3, and if not Match recursively searching for the corresponding 1/3 size subvector From the original. Did we get a better algorithm than binary search?
No hay comentarios:
Publicar un comentario