//希爾插入排序 void shellInsertSort(int *a, int dataNum) { int gap = dataNum / 2; int start = 0; while (gap >= 1) { while (start+gap<dataNum) { for (int i = start + gap; i < dataNum; i += gap) { int temp = a[i]; int j = i - gap; while (j >= start && temp < a[j]) { a[j + gap] = a[j]; a[j] = temp; j -= gap; } a[j + gap] = temp; } start += 1; } gap /= 2; start = 0; } }