//--------希尔排序--------- int part_sort(int *a, int lenght, int k) { int i = 0, j, c; int temp; while(i++ < k) { for(j = i; j < lenght; j = j + k) { for(c = j ; c >= i; c=c-k) { if( a[c] < a[c-k]) { temp = a[c]; a[c] = a[c-k]; a[c-k] = temp; } else { break; } } } } return 0; } int shell_sort(int *a, int lenght) { int k = lenght; k = k/2; while(k >= 1) { part_sort(a, lenght, k); k = k/2; } return 1; }