Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package TP5;
- public class ejernum2 {
- public static void main(String[] args) {
- Run();
- }
- public static void Run() {
- System.out.println("Ejercicio Propuesto 2 - Arbol Binario");
- BinaryTree<Character> a1 = new BinaryTree<Character>('D', new BinaryTree<Character>('F',
- new BinaryTree<Character>('G'),new BinaryTree<Character>('H')), new BinaryTree<Character>('K'));
- BinaryTree<Character> a2 = new BinaryTree<Character>('L', new BinaryTree<Character>('P',
- new BinaryTree<Character>('Q'),new BinaryTree<Character>('R')), new BinaryTree<Character>('W',null,
- new BinaryTree<Character>('Z')));
- BinaryTree<Character> a = new BinaryTree<Character>('A', a1, a2);
- System.out.printf("Arbol...... %s", a.toString());
- System.out.println();
- System.out.printf("Cantidad de NOdos;............");
- System.out.println(a.NodeCount());
- System.out.printf("Cantidad de Hojas;............");
- System.out.println(a.LeafCount());
- System.out.printf("Cantidad de NOdos internos;...");
- System.out.println(a.InternalCount());
- System.out.printf("Maximo nivel del arbol;.......");
- System.out.println(a.MaxLevel());
- System.out.printf("altura;.......................");
- System.out.println(a.Height());
- System.out.println();
- System.out.print("Pre Orden.. ");
- a.PreOrder();
- System.out.println();
- System.out.print("En Orden... ");
- a.InOrder();
- System.out.println();
- System.out.print("Post Orden. ");
- a.PostOrder();
- System.out.println();
- System.out.print("Descendente ");
- a.DescendingOrder();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment