コード例 #1
0
 public void PrintInOrder()
 {
     if (left != null)
     {
         left.PrintInOrder();
     }
     Console.WriteLine(data);
     if (right != null)
     {
         right.PrintInOrder();
     }
 }
コード例 #2
0
        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;
            }
        }