Shell sort
Idea: graphic
Code:
public static void shellSort(int[] a){
int n = a.length;
for(int h = n/ 2; h > 0; h /= 2){
for(int i = h; i < n; i++){
for(int j = i; j >= h ; j -= h){
if(a[j] < a[j - h]){
int temp = a[j];
a[j] = a[j-h];
a[j-h] = temp;
}
}
}
}
}
***帅气的远远啊***