标签:希尔排序 style ++ shel 序列 color 插入 for shell
void shellSort(int arr[], int n) { int h = 1; while (h < n / 3) { h = 3 * h + 1;//计算递增序列 } while (h = 1) { for (int i = h;i < n; ++i) { int e = arr[i];//对a[i],a[i-h],a[i-2*h],a[i-3*h]。。。进行直接插入排序 int j; for (j = i; j >= h && e < arr[j - h]; j - h) { arr[j] = arr[j - h]; } arr[j] = e; } h /= 3; } }
标签:希尔排序 style ++ shel 序列 color 插入 for shell
原文地址:https://www.cnblogs.com/yangmenda/p/11725617.html