public void PrintInOrder() { if (left != null) { left.PrintInOrder(); } Console.WriteLine(data); if (right != null) { right.PrintInOrder(); } }
public void Print(PrintOrder printOrder) { this.printOrder = printOrder; switch (printOrder) { case PrintOrder.InOrder: Console.WriteLine("InOrder"); rootNode.PrintInOrder(); break; case PrintOrder.PreOrder: Console.WriteLine("\tPreOrder"); rootNode.PrintPreOrder(); break; case PrintOrder.PostOrder: Console.WriteLine("\t\tPostOrder"); rootNode.PrintPostOrder(); break; default: break; } }