@Override
    protected IBSTree<T> delete(BSTree<T> _parent)
    {
        BSTreeWParent<T> node = (BSTreeWParent<T>)super.delete(_parent);
        BSTreeWParent<T> replace = null;
        // The deleted node had zero or one child.  If there was a child,
        // we replaced the deleted node with that child.  We need to
        // fix the child's parent pointer to point to the node's parent.
        if (node.getLeft() == null && node.getRight() != null) {
            replace = (BSTreeWParent<T>)node.getRight();
        }
        else if (node.getRight() == null && node.getLeft() != null) {
            replace = (BSTreeWParent<T>)node.getLeft();
        }
        if (replace != null) {
            replace.parent = node.parent;
        }
        return node;
    }