function expose(x) {
    var last = null;
    for (var y = x; y != null; y = y.parent) {
      splay(y);
      y.left = last;
      last = y;
    }
    splay(x);
    return last;
  }
// makes node x the root of the virtual tree, and also x becomes the leftmost node in its splay tree

makes node x the root of the virtual tree, and also x becomes the leftmost node in its splay tree
makes node x the root of the virtual tree and also x becomes the leftmost node in its splay tree
function expose(x) {
    var last = null;
    for (var y = x; y != null; y = y.parent) {
      splay(y);
      y.left = last;
      last = y;
    }
    splay(x);
    return last;
  }
function expose ( x ) { var last = null ; for ( var y = x ; y != null ; y = y . parent ) { splay ( y ) ; y . left = last ; last = y ; } splay ( x ) ; return last ; }
makes node x the root of the virtual tree, and also x becomes the leftmost node in its splay tree
makes node x the root of the virtual tree and also x becomes the leftmost node in its splay tree