Created
August 7, 2019 16:41
-
-
Save parzibyte/17600756e77caf986d388116960cb24d to your computer and use it in GitHub Desktop.
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
// Arreglo para probar | |
String[] arreglo = { "Chris", "Claire", "Django", "John", "Leon", "Morty", "Rick", "Saul", "Tuco", "Walter" }; | |
String busqueda = "Morty"; | |
// Probar primero con la recursiva | |
int indiceDelElementoBuscado = busquedaBinariaRecursiva(arreglo, busqueda, 0, arreglo.length - 1); | |
System.out.println("[Recursivo] -- El elemento buscado (" | |
+ busqueda | |
+ ") se encuentra en el index " | |
+ indiceDelElementoBuscado); | |
// Ahora con la que usa el ciclo while | |
indiceDelElementoBuscado = busquedaBinariaConWhile(arreglo, busqueda); | |
System.out.println("[Con ciclo While] -- El elemento buscado (" | |
+ busqueda | |
+ ") se encuentra en el index " | |
+ indiceDelElementoBuscado); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment