replaceChild(parent, oldChild, newChild) {
    if (parent === null) {
      this.root = newChild;
      if (this.root !== null) {
        this.root.parent = null;
      }
    } else {
      if (parent.left === oldChild) {
        parent.left = newChild;
      } else {
        parent.right = newChild;
      }
      if (newChild) {
        newChild.parent = parent;
      }
    }
  }
Replaces the given child with the new one,
for the given parent.