Advertisement
FacundoCruz

TP05E08

Nov 9th, 2020
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1.  
  2. public class TP05E08 {
  3.  
  4.     public static void main(String [] args) {
  5.        
  6.         AVLTree<Integer> arbol = new AVLTree<Integer>();
  7.         int numero,i=0;
  8.         int [] num1 = {1,2,3,4,5,6,7,15,14,13,12,11,10,9,8};
  9.         arbol.setVerbose(true);
  10.         System.out.println("Ingrese el siguiente número en forma secuencial [1,2,3,4,5,6,7,15,14,13,12,11,10,9,8] : ");
  11.         do {
  12.             do {
  13.                 numero=Helper.numeroEnteroPositivo("Ingrese Numero : ");
  14.                 if(numero != num1[i]) {
  15.                     System.err.println("Debe ingresar en forma secuencial..");
  16.                 }
  17.             }while(numero != num1[i]);
  18.             ++i;
  19.             arbol.add(numero);
  20.         }while(numero != 8);
  21.        
  22.         System.out.println("\nNumero de Rotaciones Simples : "+(arbol.countSimple));
  23.         System.out.println("Numero de Rotaciones Doble : "+(arbol.countDoble));
  24.         System.out.println("\nFIN DEL PROGRAMA...");
  25.     }
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement