希尔排序

publci class xier{


    public void xierSort(int[] data)
    {
        int i,j;
//就是间隔为gap的数相互比较,直至直接插入排序
for(int gap = data.length / 2; gap > 0; gap /= 2) { for(i = gap; i < data.length - 1; i++) { int temp = data[gap]; for(j = i - gap; j >=0 && data[j] >= temp ; j -= gap) { data[j+gap] = data[j]; } } data[j+gap] = temp; } } }
原文地址:https://www.cnblogs.com/GlazedCat/p/10549160.html