Exemplo n.º 1
0
        static void Main(string[] args)
        {
            TreeManipulations obj = new TreeManipulations();

            //obj.CalcTreeHeight();
            //obj.IsTreeBST();
            //obj.DoLevelOrderTraversal();
            //obj.DoPreOrderTraversal();
            //obj.DoReverseLevelOrderTraversal();
            //obj.DoInorderTraversal();
            //obj.DoPostOrderTraversal();
            //obj.DoReverseInorder();
            //obj.DoClosestLeafNodeTraversal();
            //obj.DoMirrorTree();
            //obj.DoSumOfLeftLeafNodes();
            //obj.DoinorderSpiral();
            //obj.ReverseTree();

            // obj.FindAncestors();
            // SearchTree obj = new SearchTree();
            //Console.WriteLine(obj.Find(obj.Root,14).value);


            //obj.DoPostOrderTraversal();
            Console.Read();

            #region ArrayToBST
            int[] arr  = new int[] { 1, 2, 3, 4, 5 };
            Tree  tree = obj.ArrayToBST(arr, 0, 4);
            #endregion

            #region IsTreeBST
            //obj.IsTreeBST();
            #endregion
        }
        static void Main(string[] args)
        {
            TreeManipulations obj = new TreeManipulations();

            //obj.CalcTreeHeight();
            //obj.DoLevelOrderTraversal();
            //obj.DoPreOrderTraversal();
            //obj.DoReverseLevelOrderTraversal();
            //obj.DoInorderTraversal();
            //obj.DoMirrorTree();
            //obj.DoinorderSpiral();
            //obj.DoPostOrderTraversal();
            //obj.DoReverseInorderTraversal();

            #region ArrayToBST
            //int[] arr = new int[] { 1,2,3,4,5};
            //Tree tree = obj.ArrayToBST(arr,0,4);
            #endregion

            #region IsTreeBST
            //obj.IsTreeBST();
            #endregion
            //obj.DoInorderViaStack();
            //obj.CheckSumInBST();
            Console.Read();
        }