public void InsertTest() { IntegerBinarySearchTree tree = new IntegerBinarySearchTree("sample"); tree.Insert(new BinaryTree <int> .Node(val: 99, name: "Ninety Nine")); Assert.IsNotNull(tree.Find(99)); }
public void InsertRangeTest() { IntegerBinarySearchTree tree = new IntegerBinarySearchTree("sample"); tree.InsertRange(new[] { new BinaryTree <int> .Node(val: 4, name: "apple"), new BinaryTree <int> .Node(val: 6, name: "banana"), new BinaryTree <int> .Node(val: 1, name: "strawberry"), new BinaryTree <int> .Node(val: 3, name: "kiwi"), new BinaryTree <int> .Node(val: 7, name: "lemon"), new BinaryTree <int> .Node(val: 10, name: "lime"), new BinaryTree <int> .Node(val: 6, name: "mango"), new BinaryTree <int> .Node(val: 8, name: "pear") }); Assert.IsNotNull(tree.Find(4)); Assert.IsNotNull(tree.Find(6)); Assert.IsNotNull(tree.Find(1)); Assert.IsNotNull(tree.Find(3)); Assert.IsNotNull(tree.Find(7)); Assert.IsNotNull(tree.Find(10)); Assert.IsNotNull(tree.Find(6)); Assert.IsNotNull(tree.Find(8)); }
public IntegerBinarySearchTree CreateTestTree() { IntegerBinarySearchTree tree = new IntegerBinarySearchTree("sample"); tree.InsertRange(new[] { new BinaryTree <int> .Node(val: 4, name: "apple"), new BinaryTree <int> .Node(val: 6, name: "banana"), new BinaryTree <int> .Node(val: 1, name: "strawberry"), new BinaryTree <int> .Node(val: 3, name: "kiwi"), new BinaryTree <int> .Node(val: 7, name: "lemon"), new BinaryTree <int> .Node(val: 10, name: "lime"), new BinaryTree <int> .Node(val: 6, name: "mango"), new BinaryTree <int> .Node(val: 8, name: "pear") }); return(tree); }