remove(e) {
    const node = this._find(e);
    if (!node) {
      throw new Error('Item not found in the tree');
    }

    if (node.left && node.right) {
      /**
       * If the node to be removed has both left and right children,
       * replace the node's value by the minimum value of the right
       * sub-tree, and remove the leave containing the value
       */
      const successor = this._findMin(node.right);
      this.remove(successor.value);
      node.value = successor.value;
    } else {
      /**
       * If the node is a leaf, just make the parent point to null,
       * and if it has one child, make the parent point to this child
       * instead
       */
      this._replaceNodeInParent(node, node.left || node.right);
      this._size--;
    }
  }
Remove an element from the BST