Exemplo n.º 1
0
        static void Main()
        {
            Wezel tree = SampleTree.BasicTree();

            Console.WriteLine("DFS -->"); DFSTree.DfsTravel(tree);

            Console.ReadLine();
        }
Exemplo n.º 2
0
 public static void DfsTravel(Wezel wezel)
 {
     if (wezel == null)
     {
         return;
     }
     Console.Write(wezel.icon + " ");
     DfsTravel(wezel.lewy);
     DfsTravel(wezel.prawy);
 }
Exemplo n.º 3
0
        public static Wezel BasicTree()
        {
            Wezel root =
                new Wezel("A",
                          new Wezel("B",
                                    new Wezel("C"), new Wezel("D")),
                          new Wezel("E",
                                    new Wezel("F"), new Wezel("G",
                                                              new Wezel("H"), null)));

            return(root);
        }
Exemplo n.º 4
0
 public Wezel(String icon)
 {
     this.icon  = icon;
     this.lewy  = null;
     this.prawy = null;
 }
Exemplo n.º 5
0
 public Wezel(String icon, Wezel lewy, Wezel prawy)
 {
     this.lewy  = lewy;
     this.prawy = prawy;
     this.icon  = icon;
 }