public static void Main(string[] args)
        {
            ArbolBinarioBusqueda abb = new ArbolBinarioBusqueda(null);

            abb.agregar(3);
            abb.agregar(1);
            abb.agregar(4);
            abb.agregar(6);
            abb.agregar(8);
            abb.agregar(2);
            abb.agregar(5);
            abb.agregar(7);

            Console.WriteLine("****PREORDEN*****\n");
            abb.preOrden();

            Console.WriteLine("\n\n****POSTORDEN*****\n");
            abb.postOrden();

            Console.WriteLine("\n\n****INORDEN*****\n");
            abb.inOrden();

            Console.WriteLine("\n\nIngrese un valor (si el valor esta en el arbol, retornara 'true'.\nDe lo contrario sera 'false': ");
            int elemento = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("\n" + abb.incluye(elemento) + " Saludos :)");

            Console.Write("\nPress any key to continue . . . ");
            Console.ReadKey(true);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            ArbolBinarioBusqueda tree = new ArbolBinarioBusqueda(5);

            tree.agregar(6);
            tree.agregar(7);
            tree.preorden();

            Console.WriteLine("-------------------------");
            AVL nodoraiz = new AVL(5);

            nodoraiz.agregar(6);
            nodoraiz.agregar(7);
            nodoraiz.agregar(8);
            nodoraiz.agregar(9);
            nodoraiz.agregar(4);
            nodoraiz.agregar(3);

            nodoraiz.preorden();
        }
Beispiel #3
0
 public void eliminarHijoDerecho()
 {
     this.hijoDerecho = null;
 }
Beispiel #4
0
 public void eliminarHijoIzquierdo()
 {
     this.hijoIzquierdo = null;
 }
Beispiel #5
0
 public void agregarHijoDerecho(ArbolBinarioBusqueda hijo)
 {
     this.hijoDerecho = hijo;
 }
Beispiel #6
0
 public void agregarHijoIzquierdo(ArbolBinarioBusqueda hijo)
 {
     this.hijoIzquierdo = hijo;
 }