public boolean bst(BinaryNode<T> node) {
    if (node.getData() == null) {
      return true;
    }

    if (node.getLeftChild() != null
        && node.getData().compareTo(node.getLeftChild().getData()) < 0) {
      return false;
    }

    if (node.getRightChild() != null
        && node.getData().compareTo(node.getRightChild().getData()) < 0) {
      return false;
    }

    return (node.getLeftChild() == null || bst(node.getLeftChild()))
        && (node.getRightChild() == null || bst(node.getRightChild()));
  }
  public T rMax(BinaryNode<T> node, T max) {
    if (!isEmpty()) {
      if (node.hasLeftChild()) max = rMax(node.getLeftChild(), max);
      if (node.hasRightChild()) max = rMax(node.getRightChild(), max);

      if (max == null) max = node.getData();
      else if (max.compareTo(node.getData()) == -1) max = node.getData();
    }

    return max;
  }
  public T rMin(BinaryNode<T> node, T min) {
    if (!isEmpty()) {
      if (node.hasLeftChild()) {
        min = rMin(node.getLeftChild(), min);
      }
      if (node.hasRightChild()) {
        min = rMin(node.getRightChild(), min);
      }

      if (min == null) // if neither side has a child, set min to the node
      {
        min = node.getData();
      } else if (min.compareTo(node.getData()) == 1) {
        min = node.getData();
      }
    }

    return min;
  }