示例#1
0
        static void Main()
        {
            Wezel tree = SampleTree.BasicTree();

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

            Console.ReadLine();
        }
示例#2
0
 public static void DfsTravel(Wezel wezel)
 {
     if (wezel == null)
     {
         return;
     }
     Console.Write(wezel.icon + " ");
     DfsTravel(wezel.lewy);
     DfsTravel(wezel.prawy);
 }
示例#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);
        }
示例#4
0
 public Wezel(String icon)
 {
     this.icon  = icon;
     this.lewy  = null;
     this.prawy = null;
 }
示例#5
0
 public Wezel(String icon, Wezel lewy, Wezel prawy)
 {
     this.lewy  = lewy;
     this.prawy = prawy;
     this.icon  = icon;
 }