我正在编写排序算法——Shellsort。错误在哪里?
int shellsort( int ai_numbers[], const int ci_count ){
int i, j, temp, counter = 0, inc;
inc = ci_count / 2;
while ( inc > 0 )
{
for ( i = inc + 1; i < ci_count ; i++)
{
temp = ai_numbers[i];
j = i;
while ( j > inc && ai_numbers[j - inc] > temp )
{
ai_numbers[j] = ai_numbers[j - inc];
j = j - inc;
counter++;
}
ai_numbers[j] = temp;
}
inc = (int) (inc / 2.2);
}
return counter;
}