Пример #1
0
        static void Main(string[] args)
        {
            TreeProblems tp = new TreeProblems();
            //BinaryTreeNodeParent pa=tp.AssignParent(GetTrees.UnBalancedTreeParent());
            //pa = tp.AssignGrandParent(pa);

            //tp.InOrderValues(GetTrees.UnBalancedTree());
            //foreach (var item in tp.inOrder)
            //    Console.WriteLine(item);
            //tp.preOrderValues(GetTrees.UnBalancedTree());
            //foreach (var item in tp.preOrder)
            //    Console.WriteLine(item);

            //BinaryTreeNode r = tp.CreateTree(tp.preOrder, tp.inOrder);
            BinaryTreeNode n1 = GetTrees.SimpleTree();
            //  BinarySearchTree bt= new BinarySearchTree();
            BinaryTreeNode n2 = GetTrees.SimpleTree();

            // bt.Insert(ref bst, new BinaryTreeNode(6));
            //bt.Insert(ref bst, new BinaryTreeNode(12));
            // bt.Insert(ref bst, new BinaryTreeNode(10));
            Console.WriteLine(tp.IsBST(n1));
        }
Пример #2
0
        static void Main(string[] args)
        {
            TreeProblems tp = new TreeProblems();
            //BinaryTreeNodeParent pa=tp.AssignParent(GetTrees.UnBalancedTreeParent());
            //pa = tp.AssignGrandParent(pa);

            //tp.InOrderValues(GetTrees.UnBalancedTree());
            //foreach (var item in tp.inOrder)
            //    Console.WriteLine(item);
            //tp.preOrderValues(GetTrees.UnBalancedTree());
            //foreach (var item in tp.preOrder)
            //    Console.WriteLine(item);

            //BinaryTreeNode r = tp.CreateTree(tp.preOrder, tp.inOrder);
            BinaryTreeNode n1 = GetTrees.SimpleTree();
              //  BinarySearchTree bt= new BinarySearchTree();
            BinaryTreeNode n2 = GetTrees.SimpleTree();
               // bt.Insert(ref bst, new BinaryTreeNode(6));
            //bt.Insert(ref bst, new BinaryTreeNode(12));
            // bt.Insert(ref bst, new BinaryTreeNode(10));
            Console.WriteLine(tp.IsBST(n1));
        }