RedBlackTree.prototype.rotateRight = function (x) {
    var y = x.getLeft();
    x.left = y.getRight();
    if (typeof y.getRight().key !== 'undefined') {
      y.getRight().parent = x;