docs: int isLeaf( int i , int j ) {
          jleaf = 0;
  
          // see j is not a leaf
          if( i <= j || w[first+j] <= w[maxfirst+i] )
              return -1;
  
          w[maxfirst+i] = w[first+j]; // update the max first[j] seen so far
          int jprev = w[prevleaf+i];
          w[prevleaf+i]=j;
  
          if( jprev == -1 ) { // j is the first leaf
              jleaf = 1;
              return i;
          } else {           // j is a subsequent leaf
              jleaf = 2;
          }
  
          // find the common ancestor with jprev
          int q;
          for( q = jprev; q != w[ancestor+q]; q = w[ancestor+q]){
          }
          // path compression
          for( int s = jprev, sparent; s != q; s = sparent ) {
              sparent = w[ancestor+s];
              w[ancestor+s] = q;
          }
          return q;
      }