Exemplo n.º 1
0
        public void TestSize()
        {
            var bst = new BinarySearchTree<char, int>();
            Assert.AreEqual(0, bst.Size());
            bst.Put('A', 1);
            Assert.AreEqual(1, bst.Size());

            Assert.AreEqual(_result.Length, CreateBST().Size());
        }
Exemplo n.º 2
0
 private static BinarySearchTree<string, int> CreateBST()
 {
     ;
     var result = new BinarySearchTree<string, int>(StringComparer.Ordinal);
     for (int i = 0; i < _fixture.Length; i++) {
         result.Put(_fixture[i], i);
     }
     return result;
 }
Exemplo n.º 3
0
 public void TestIsEmpty()
 {
     var bst = new BinarySearchTree<char, int>();
     Assert.True(bst.IsEmpty());
     bst.Put('A', 1);
     Assert.False(bst.IsEmpty());
 }