private static <TNode extends AvlNode> TNode removeMin(TNode p) {
      if (p.avlLeft == null) return (TNode) p.avlRight;
      p.avlLeft = removeMin(p.avlLeft);
      return balance(p);
    }
Insert a node into the tree. This is useful when you want to create a new node or replace the
content depending if the node already exists or not. Using AvlInsertOrReplace class you can
return the node to add/replace.
@param root            the current root of the tree
@param key             the key for the node we are trying to insert
@param keyComparator   the comparator to use to match node and key
@param insertOrReplace the class to use to insert or replace the node
@return the new root of the tree
hbase-common/src/main/java/org/apache/hadoop/hbase/util/AvlUtil.java