public void TestTreeToString() { KevinBst <string> testTree = BuildTestTree(); IVisitor <string> visitor = new StringBuilderVisitor(); testTree.TraverseInOrder(visitor); Console.WriteLine(visitor.ToString()); }
public void RemoveRightChildLeafNode() { KevinBst <string> testTree = BuildTestTree(); testTree.Remove(key: 15); IVisitor <string> visitor = new StringBuilderVisitor(); testTree.TraverseInOrder(visitor); Console.WriteLine(visitor.ToString()); }
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()); }
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()); }