static void Main() { Wezel tree = SampleTree.BasicTree(); Console.WriteLine("DFS -->"); DFSTree.DfsTravel(tree); Console.ReadLine(); }
public static void DfsTravel(Wezel wezel) { if (wezel == null) { return; } Console.Write(wezel.icon + " "); DfsTravel(wezel.lewy); DfsTravel(wezel.prawy); }
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); }
public Wezel(String icon) { this.icon = icon; this.lewy = null; this.prawy = null; }
public Wezel(String icon, Wezel lewy, Wezel prawy) { this.lewy = lewy; this.prawy = prawy; this.icon = icon; }