@Test public void testHeight() { assertEquals("Height of empty tree wrong", -1, tree.height()); tree.add(20, "lk"); assertEquals("Height wrong for 1 entry", 0, tree.height()); tree.add(1, "lkd"); assertEquals("Height wrong for 2 entry", 1, tree.height()); tree.add(5, "ksjdf"); tree.add(28, "skdjf"); tree.add(32, "sd"); tree.add(30, "d"); tree.add(40, "zz"); assertEquals("Height wrong for mult entries", 3, tree.height()); }
@Override public int height() { if (root==null){ return -1; } else { return root.getHeight(); } }
AVLTreeImpl implements IAVLBinaryTree<K, V> { @Override public int height() { if (root==null){ return -1; } else { return root.getHeight(); } } }
AVLTreeImpl implements IAVLBinaryTree<K, V> { @Override public int height() { if (root==null){ return -1; } else { return root.getHeight(); } } AVLTreeImpl(boolean rotate); }
AVLTreeImpl implements IAVLBinaryTree<K, V> { @Override public int height() { if (root==null){ return -1; } else { return root.getHeight(); } } AVLTreeImpl(boolean rotate); void resetOpsCount(); int getOpsCount(); @Override boolean isEmpty(); @Override int size(); @Override void add(K key, V data); @Override boolean remove(K key); @Override K min(); @Override K max(); @Override int height(); @Override K root(); @Override BSTNode<K,V> getRootNode(); @Override V find(K key); @Override List<K> preorderTraversal(); @Override List<K> postorderTraversal(); @Override List<K> inorderTraversal(); @Override List<K> levelorderTraversal(); static void main(String[] args); }
AVLTreeImpl implements IAVLBinaryTree<K, V> { @Override public int height() { if (root==null){ return -1; } else { return root.getHeight(); } } AVLTreeImpl(boolean rotate); void resetOpsCount(); int getOpsCount(); @Override boolean isEmpty(); @Override int size(); @Override void add(K key, V data); @Override boolean remove(K key); @Override K min(); @Override K max(); @Override int height(); @Override K root(); @Override BSTNode<K,V> getRootNode(); @Override V find(K key); @Override List<K> preorderTraversal(); @Override List<K> postorderTraversal(); @Override List<K> inorderTraversal(); @Override List<K> levelorderTraversal(); static void main(String[] args);  }