Exemplo n.º 1
0
 public void UnbalancedBstRightHeavy()
 {
     tree.Root             = new Node <int>(10);
     tree.Root.Right       = new Node <int>(22);
     tree.Root.Right.Right = new Node <int>(33);
     Assert.True(Q01 <int> .IsBst(tree));
 }
Exemplo n.º 2
0
 public void IsBst02_EqualNodes()
 {
     tree.Root       = new Node <int>(10);
     tree.Root.Left  = new Node <int>(10);
     tree.Root.Right = new Node <int>(10);
     Assert.True(Q01 <int> .IsBst(tree));
 }
Exemplo n.º 3
0
 public void UnbalancedBstLeftHeavy()
 {
     tree.Root           = new Node <int>(10);
     tree.Root.Left      = new Node <int>(5);
     tree.Root.Left.Left = new Node <int>(1);
     Assert.True(Q01 <int> .IsBst(tree));
 }
Exemplo n.º 4
0
 public void SimpleBst()
 {
     tree.Root       = new Node <int>(10);
     tree.Root.Left  = new Node <int>(5);
     tree.Root.Right = new Node <int>(99);
     Assert.True(Q01 <int> .IsBst(tree));
 }
Exemplo n.º 5
0
 public void NotBst02()
 {
     tree.Root             = new Node <int>(10);
     tree.Root.Left        = new Node <int>(5);
     tree.Root.Left.Left   = new Node <int>(1);
     tree.Root.Left.Right  = new Node <int>(7);
     tree.Root.Right       = new Node <int>(99);
     tree.Root.Right.Left  = new Node <int>(150); //violates BST property
     tree.Root.Right.Right = new Node <int>(200);
     Assert.False(Q01 <int> .IsBst(tree));
 }
Exemplo n.º 6
0
 public void IsBst01()
 {
     tree.Root             = new Node <int>(10);
     tree.Root.Left        = new Node <int>(5);
     tree.Root.Left.Left   = new Node <int>(1);
     tree.Root.Left.Right  = new Node <int>(7);
     tree.Root.Right       = new Node <int>(99);
     tree.Root.Right.Left  = new Node <int>(55);
     tree.Root.Right.Right = new Node <int>(100);
     Assert.True(Q01 <int> .IsBst(tree));
 }
Exemplo n.º 7
0
 public void IsBst03_MoreEqualNodes()
 {
     tree.Root                   = new Node <int>(10);
     tree.Root.Left              = new Node <int>(5);
     tree.Root.Left.Left         = new Node <int>(1);
     tree.Root.Left.Right        = new Node <int>(10);
     tree.Root.Right             = new Node <int>(99);
     tree.Root.Right.Left        = new Node <int>(99);
     tree.Root.Right.Right       = new Node <int>(200);
     tree.Root.Right.Right.Left  = new Node <int>(155);
     tree.Root.Right.Right.Right = new Node <int>(200);
     Assert.True(Q01 <int> .IsBst(tree));
 }
Exemplo n.º 8
0
 public void NoRoot()
 {
     Assert.False(Q01 <int> .IsBst(tree));
 }
Exemplo n.º 9
0
 public void RootOnly()
 {
     tree.Root = new Node <int>(5);
     Assert.True(Q01 <int> .IsBst(tree));
 }
Exemplo n.º 10
0
 public void VerifyBst()
 {
     Assert.True(Q01 <int> .IsBst(exampleTree));
 }