static void Main(string[] args) { Arbol <int> myArbol = new Arbol <int>(20, new Arbol <int>(4, new Arbol <int>(10), new Arbol <int>(15, new Arbol <int>(-1, new Arbol <int>(-5), new Arbol <int>(11), new Arbol <int>(3, new Arbol <int>(-9, new Arbol <int>(14)))))), new Arbol <int>(30), new Arbol <int>(-22), new Arbol <int>(25, new Arbol <int>(17, new Arbol <int>(4), new Arbol <int>(14), new Arbol <int>(2), new Arbol <int>(-11)), new Arbol <int>(-8), new Arbol <int>(7, new Arbol <int>(13, new Arbol <int>(40)), new Arbol <int>(33)))); Iterador <int> miIterador = new Iterador <int>(); int nivel = 0; foreach (IEnumerable <int> nodos in miIterador.IteradorAloAncho(myArbol, ValoresPositivos)) { Console.WriteLine("Nivel {0}", nivel); foreach (int k in nodos) { Console.Write("{0} ", k); } Console.WriteLine(); nivel++; } }