-
-
Save parzibyte/e189b2ec10ee03a9ebb478036597b4ea 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
public static void main(String[] args) { | |
String eleccion = ""; | |
Arbol arbol = null; | |
Scanner sc = new Scanner(System.in); | |
while (!eleccion.equals("5")) { | |
System.out.println("1. Ingresar"); | |
System.out.println("2. Visualizar Pre-Orden"); | |
System.out.println("3. Visualizar Pos-Orden"); | |
System.out.println("4. Visualizar In-Orden"); | |
System.out.println("5. Salir"); | |
System.out.println("Elige: "); | |
eleccion = sc.nextLine(); | |
if (eleccion.equals("1")) { | |
arbol = AyudanteDatos.obtenerArbol(); | |
} else if (eleccion.equals("2")) { | |
if (arbol != null) { | |
arbol.preorden(); | |
} else { | |
System.out.println("No has ingresado nada"); | |
} | |
} else if (eleccion.equals("3")) { | |
if (arbol != null) { | |
arbol.postorden(); | |
} else { | |
System.out.println("No has ingresado nada"); | |
} | |
} else if (eleccion.equals("4")) { | |
if (arbol != null) { | |
arbol.inorden(); | |
} else { | |
System.out.println("No has ingresado nada"); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment