// 希尔排序
void ShellSort(int* data, int len)
{
int j, tmp;
int gap = len; // 增量
do
{
gap = gap/3 + 1;
for (int i = gap; i < len; i++) {
if(data[i] < data[i - gap])
{
tmp = data[i];
for (j = i - gap; j >= 0 && data[j] > tmp; j -= gap) {
data[j + gap] = data[j];
}
data[j + gap] = tmp;
}
}
}while(gap > 1);
}