function rightRotation(node) {
  const newParent = node.left; // E.g., node 4
  const grandparent = node.parent; // E.g., node 64
  const previousRight = newParent.right; // E.g., node 8

  // swap node 64's left children (node 16) with node 4 (newParent).
  swapParentChild(node, newParent, grandparent);

  // update node 4's right child to be node 16,
  // also make node 4 the new parent of node 16.
  newParent.setRightAndUpdateParent(node);
  // Update 16's left child to be the `previousRight` node.
  node.setLeftAndUpdateParent(previousRight);

  return newParent;
}
Single Right Rotation (RR Rotation)
@example: #1 rotate node 3 to the right

      4                                  4
     /                                  /
    3*                                 2
   /                                 /  \
  2    ---| right-rotation(3) |-->  1    3*
 /
1

@example: #2 rotate 16 to the right and preserve nodes
      64                                       64
      /                                        /
     16*                                      4
     / \                                     / \
    4  32    -- right-rotation(16) -->      2   16
   / \                                     /    / \
  2   8                                   1    8   32
 /
1

@param {TreeNode} node
   this is the node we want to rotate to the right. (E.g., node 16)
@returns {TreeNode} new parent after the rotation (E.g., node 4)