Home > Back-end >  Hill sorting algorithm
Hill sorting algorithm

Time:12-23

#include
8 # define n
Typedef int datatype.
Void ShellInsert (datatype R [], int dk)
{int I, j;
Dk for (I=+ 1; i<=n; I++)
If (R [I] {R [0]=R [I];
For (j=I - dk; (j> 0) & amp; & R [0] R=R + dk [j] [j];
}
R=R + dk [j] [0]. }
Void ShellSort (datatype R [], int t)
{int d [10].
For (int k=0; kThe scanf (" % d ", & amp; D [k]);
For (k=0; kShellInsert (R and d [k]); }
Void main (datatype R [])
{int I, j;
int k;
Printf (" integer before ordering: ");
for(j=1; j<=n; J++)
The scanf (" % d ", & amp; R [j]);
printf("\n");
ShellSort (R, 3);
Printf (" sorted integers: ");
for(k=1; k<=n; K++)
Printf (" % d ", R [k]);
printf("\n");
}

CodePudding user response:

Various sorting algorithm demo http://www.webhek.com/misc/comparison-sort/
  • Related