private AVLNode SingleRotateWithRight(AVLNode k2) { AVLNode k1; k1 = k2.getRight(); k2.setRight(k1.getLeft()); k1.setLeft(k2); k2.setHeight(Math.max(Height(k2.getLeft()), Height(k2.getRight())) + 1); k1.setHeight(Math.max(Height(k1.getLeft()), k2.getHeight()) + 1); return k1; }
@Override public String toString() { return title + String.valueOf(node.getValue()) + "|" + node.getHeight(); }
int Height(AVLNode avl) { if (avl == null) return -1; else return avl.getHeight(); }