void shellSort(int buf[], int n)
{
int i;
int j;
int increMent;
int tmp;
for(increMent=n/2; increMent>0; increMent/=2)
{
for(i=increMent; i<n; i++)
{
tmp = buf[i];
for(j=i; j>=increMent; j-=increMent)
{
if(tmp < buf[j-increMent])
buf[j] = buf[j-increMent];
else
break;
}
buf[j] = tmp;
}
}
return;
}
shell排序代码
最新推荐文章于 2021-11-18 17:39:16 发布