insert(value, parent) {
    // Set the root as the initial insertion point
    // if it has not been passed
    if (!parent) {
      if (!this.root) {
        this.root = new Node(value);
        this._size++;
        return;
      }
      parent = this.root;
    }

    const child = this._comparator.lessThan(value, parent.value)
      ? 'left'
      : 'right';
    if (parent[child]) {
      this.insert(value, parent[child]);
    } else {
      parent[child] = new Node(value, parent);
      this._size++;
    }
  }
Insert elements to the tree respecting the BST restrictions