初级工程师之排序算法一一一一一希尔排序算法java实现
public static int[] hellSort(int[] sums) { //步长每次减半,分组就行直接插入 for (int x = sums.length/2; x >0 ; x=x/2) { //步长条约,等同于分成不同数组进行 for (int j = sums.length-1; j-x > 0; j--) { //关键判断决策增序还是降序序 >增序 <降序 if (sums[j-x] > sums[j]) { int temp = sums[j]; sums[j] = sums[j-x]; sums[j-x] = temp; } } } return sums; }