Ejemplo n.º 1
0
 @Test
 public void testGetBalancedFactor() throws Exception {
   for (int i = 0; i < 10; i++) {
     avlTree.insert(i);
   }
   Assert.assertTrue(Math.abs(avlTree.getBalancedFactor()) <= 1);
 }
Ejemplo n.º 2
0
 @Test
 public void testSize() throws Exception {
   for (int i = 0; i < 10; i++) {
     avlTree.insert(i);
   }
   Assert.assertEquals(avlTree.getSize(), 10);
 }
Ejemplo n.º 3
0
 @Test
 public void test1() {
   int[] input1 = {22, 11, 1, 2, 3, 4, 5};
   int[] input = input1;
   for (int i = 0; i < input.length; i++) {
     tree.insert(new Integer(input[i]));
   }
   Object found = tree.find(new Integer(4));
   assertNotNull(found);
   found = tree.find(new Integer(99));
   assertNull(found);
   tree.printNodes();
 }