Example #1
0
        public static void PerformLevelOrderSpiralTraversal()
        {
            LevelOrderSpiralTraversal levelOrderSpiralTree = new LevelOrderSpiralTraversal();

            levelOrderSpiralTree.binaryTree.root            = new Node(1);
            levelOrderSpiralTree.binaryTree.root.left       = new Node(2);
            levelOrderSpiralTree.binaryTree.root.right      = new Node(3);
            levelOrderSpiralTree.binaryTree.root.left.left  = new Node(4);
            levelOrderSpiralTree.binaryTree.root.left.right = new Node(5);

            Console.WriteLine("Level order spiral traversal of binary tree (Each level data in seperate lines) ");
            levelOrderSpiralTree.TraverseSpirallyAndPrintEachLevelInNewLine();
        }
Example #2
0
        static void Main(string[] args)
        {
            //BinaryTree bTree = Utilities.CreateBinaryTree();
            //Utilities.FindTheMaxNode(bTree.root);
            //Utilities.SearchForAKey(bTree.root, 30);
            //Utilities.SearchForAKey(bTree.root, 31);
            //Console.ReadLine();

            //RecursiveLevelOrderTraversal.PerformRecursiveLevelOrderTraversal();
            //Console.ReadLine();

            //LevelOrderTraversalUsingQueue.PerformLevelOrderTraversalUsingQueue();
            //Console.ReadLine();

            //InOrderTraversal.PerformInOrderTraversal();
            //Console.ReadLine();

            //PreOrderTraversal.PerformPreOrderPreOrderTraversal();
            //Console.ReadLine();

            //PostOrderTraversal.PerformPostOrderPostOrderTraversal();
            //Console.ReadLine();

            //TreeSize.PerformCalculationOfTreeSize();
            //Console.ReadLine();

            //IdenticalTrees.VerifyIfTressAreIdentical();
            //Console.ReadLine();

            //TreeHeight.PerformTreeHeightCalculation();
            //Console.ReadLine();

            //MirrorTree.PerformMirrorImagingOfTree();
            //Console.ReadLine();

            //LeafNodesCount.PerformLeafNodesInATreeCalculation();
            //Console.ReadLine();

            LevelOrderSpiralTraversal.PerformLevelOrderSpiralTraversal();
            Console.ReadLine();
        }