예제 #1
0
        public void RemoveLeftChildOnlyHasLeftChild()
        {
            KevinBst <string> testTree = BuildTestTree();

            testTree.Remove(key: 15);
            // now 10 only has left child 5
            testTree.Remove(key: 10);
            IVisitor <string> visitor = new StringBuilderVisitor();

            testTree.TraverseInOrder(visitor);
            Console.WriteLine(visitor.ToString());
        }
예제 #2
0
        public void RemoveRightChildOnlyHasRightChild()
        {
            KevinBst <string> testTree = BuildTestTree();

            testTree.Remove(key: 25);
            // now 30 only has right child 35
            testTree.Remove(key: 30);
            IVisitor <string> visitor = new StringBuilderVisitor();

            testTree.TraverseInOrder(visitor);
            Console.WriteLine(visitor.ToString());
        }
예제 #3
0
        public void EmptyTreeRemove()
        {
            KevinBst <string> stringTree = new KevinBst <string>();
            int key = 0;

            stringTree.Remove(key);
        }
예제 #4
0
        public void RemoveRightChildLeafNode()
        {
            KevinBst <string> testTree = BuildTestTree();

            testTree.Remove(key: 15);
            IVisitor <string> visitor = new StringBuilderVisitor();

            testTree.TraverseInOrder(visitor);
            Console.WriteLine(visitor.ToString());
        }