    tree rrot( t )
    tree t;

    { tree temp;
      int b;

      temp = t;
      t = t->left;
      temp->left = t->right;
      t->right = temp;
      /*** adjust balance ***/
      b = temp->bal;
      temp->bal = b + 1 + max( -t->bal, 0 );
      t->bal = -min( -b-2, min( -b-t->bal-2, -t->bal-1));
      return( t );
    }
