code: static void insertionSortBy(int[] vs, int lo, int len, long[] curr, long[] prev) {
          for (int j = lo + 1, hi = lo + len; j < hi; j++) {
              int v = vs[j];
              int i = j - 1;
              while ((i >= lo) && less(v, vs[i], curr, prev))
                  vs[i + 1] = vs[i--];
              vs[i + 1] = v;
          }
      }
docs: Sort the values (using insertion sort) in {@code vs} from {@code lo}
  (until {@code len}) by the {@code prev[]} and then {@code curr[]}
  invariants to determine rank. The values in {@code vs} are indices into
  the invariant arrays.
  
  @param vs   values (indices)
  @param lo   the first value to start sorting from
  @param len  the len of values to consider
  @param curr the current invariants
  @param prev the previous invariants