常用的基础算法总结之 希尔排序
package TT; public class Test206 { public static void shellSort(int[] data){ int h=1; while(h<=data.length/3){ h=h*3+1; } while(h>0){ for(int i =h; i<data.length; i+=h){ if(data[i]<data[i-h]){ int tmp = data[i]; int j =i-h; while(j>=0 && tmp<data[j]){ data[j+h]=data[j]; j-=h; } data[j+h]=tmp; } } h=(h-1)/3; } } }