perl多关键字排序 perl逆序
perl多关键字排序 perl逆序2012年01月19日
perl reverse sort {} map {} grep {} @a; sort comparator -1 1 0 不稳定排序(快速排序)
多关键字可以用:
$ka1$kb1
or $ka2$kb2
or $ka3$kb3
...
逆序输出可以用:
reverse
private static void mergeSort(Object[] src,
Object[] dest,
int low, int high, int off,
Comparator c) {
int length = high - low;
// Insertion sort on smallest arrays
if (length low && c.compare(dest, dest)>0; j--)
swap(dest, j, j-1);
return;
}
// Recursively sort halves of dest into src
int destLow= low;
int destHigh = high;
low+= off;
high += off;
int mid = (low + high) >>> 1;
mergeSort(dest, src, low, mid, -off, c);
mergeSort(dest, src, mid, high, -off, c);
// If list is already sorted, just copy from src to dest.This is an
// optimization that results in faster sorts for nearly ordered lists.
if (c.compare(src, src) = high || p < mid && c.compare(src, src) <= 0)
dest = src;
else
dest = src;
}
}
页:
[1]