public void LoadFile() { System.IO.StreamReader lector = new System.IO.StreamReader(path); while (!lector.EndOfStream) { string linea = lector.ReadLine(); string[] valores = linea.Split(","); InfoIndice nuevoIndice = new InfoIndice(); nuevoIndice.Linea = Convert.ToInt32(valores[0]); nuevoIndice.Nombre = valores[1]; nuevoIndice.Existencia = Convert.ToInt32(valores[5]); arbolBinario.Agregar(nuevoIndice, nuevoIndice.Nombre); } lector.Close(); }
static void Main(string[] args) { ArbolBinario ggmen = new ArbolBinario(); int ob; int a = 42, b = 53, c = 33, d = 53, e = 72, f = 6, g = 7; Console.WriteLine(" Insertando valores manualmente en el árbol: "); ggmen.Agregar(a); ggmen.Agregar(b); ggmen.Agregar(c); ggmen.Agregar(d); ggmen.Agregar(e); ggmen.Agregar(f); ggmen.Agregar(g); Console.WriteLine(" " + " " + " " + "/" + "e"); Console.WriteLine(" " + " " + "/" + "b"); Console.WriteLine(" " + "/" + "a"); Console.WriteLine("|--" + "g"); Console.WriteLine("c"); Console.WriteLine("|_" + "f"); Console.WriteLine("|_" + "d"); Console.WriteLine("Valores insertados: " + a + " " + b + " " + c + " " + d + " " + e + " " + f + " " + g); ggmen.PrintAlturaDeCadaNod(); do { Console.WriteLine("/////////////////////////////// "); Console.WriteLine("1.-Cantidad de nodos del arbol."); Console.WriteLine("2.-Altura del arbol."); Console.WriteLine("0.-Salir"); ob = int.Parse(Console.ReadLine()); switch (ob) { case 1: Console.WriteLine("Cantidad de nodos del árbol:" + ggmen.Cantidad()); break; case 2: Console.WriteLine("La altura del arbol es:" + ggmen.ReturnAltura()); break; } } while (ob != 0); }