예제 #1
0
        public static void Run()
        {
            var initNode = TreeInitializer.Initialize();

            ConvertToBinaryTree(initNode.treeNode, 7);
            Console.WriteLine($"ConvertToBinaryTree - IsBST : {CheckIfBinaryTreeBST.IsBinarySearchTree(initNode.treeNode)} ");
        }
        public static void Run()
        {
            var initNode = TreeInitializer.Initialize();

            Console.WriteLine($"Height of Tree : {Height(initNode.treeNode)}");
            Node <int> newNodeToAdd = new Node <int>()
            {
                Value = 25
            };

            AddNewNodeAndTranformToBST(initNode.treeNode, newNodeToAdd);
            Console.WriteLine($"AddNewNodeAndTranformToBST - IsBST : {CheckIfBinaryTreeBST.IsBinarySearchTree(initNode.treeNode)} ");
        }
예제 #3
0
        public static void Run()
        {
            var        initNode      = TreeInitializer.Initialize();
            Node <int> newNodeForBST = new Node <int>()
            {
                Value = 4
            };

            AddNewNodeToBST(initNode.bstNode, newNodeForBST);
            Console.WriteLine($"AddNewNodeToBST - IsBST : {CheckIfBinaryTreeBST.IsBinarySearchTree(initNode.bstNode)} ");
            Console.WriteLine($"InOrder for BST : ");
            TreeTraversal.InOrderTraversal(initNode.bstNode);
        }