예제 #1
0
        public void AssertValidTree_InvalidChildren()
        {
            var root = new AVLNode <int>(100);

            root.Left = new AVLNode <int>(150);

            AVLTree <int> bst = new AVLTree <int>();

            bst.Root = root;

            bst.AssertValidTree();
        }
예제 #2
0
        public void AssertValidTree_InvalidBalance_Left()
        {
            var root = new AVLNode<int>(100);
            root.Left = new AVLNode<int>(50);
            root.Right = new AVLNode<int>(150);
            root.Left.Left = new AVLNode<int>(30);
            root.Left.Left.Left = new AVLNode<int>(20);

            AVLTree<int> bst = new AVLTree<int>();
            bst.Root = root;

            bst.AssertValidTree();
        }
예제 #3
0
        public void AssertValidTree_InvalidBalance_Right()
        {
            var root = new AVLNode <int>(100);

            root.Left              = new AVLNode <int>(50);
            root.Right             = new AVLNode <int>(150);
            root.Right.Right       = new AVLNode <int>(160);
            root.Right.Right.Right = new AVLNode <int>(170);

            AVLTree <int> bst = new AVLTree <int>();

            bst.Root = root;

            bst.AssertValidTree();
        }
예제 #4
0
        public void AssertValidTree_InvalidChildren()
        {
            var root = new AVLNode<int>(100);
            root.Left = new AVLNode<int>(150);

            AVLTree<int> bst = new AVLTree<int>();
            bst.Root = root;

            bst.AssertValidTree();
        }