Anonymous user
Sorting algorithms/Shell sort: Difference between revisions
m
→{{header|C}}
(commo lisp shell sort) |
m (→{{header|C}}) |
||
Line 141:
int main (int argc, char *argv[])
{
int intArray[ARRAYSIZE], i, increment;
for(i=0; i<
intArray[i] = rand();
}
void shellsort (int a[], int length)
{
int i, j, k, temp, increment;
static int incSequence[] = {412771, 165103, 66041, 26417, 10567,
4231, 1693, 673, 269, 107, 43, 17, 7, 3, 1};
Line 157:
{
if (incSequence[k]*2 > length) continue;
increment = incSequence[k];
for (i=increment; i < length; i++)
{
Line 168:
a[j + increment] = temp;
}
}
}</lang>
|