Exemple #1
0
        public void PrintPreOrder()
        {
            string spacing = "\t";

            Console.WriteLine(spacing + data);
            if (left != null)
            {
                left.PrintPreOrder();
            }
            if (right != null)
            {
                right.PrintPreOrder();
            }
        }
Exemple #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;
            }
        }