1 # include "stdio.h"
2
3 void main ()
4
5 {
6 int t=0 ,N=10;int A[]={49,38,65,97,76,13,27,49,55,04};
7 for ( t=0;t<10;t++)
8 {
9 printf("%5d",A[t]);
10 }
11
12 int i=0 ,j,Increament; int Tmp;
13 for(Increament=N/2;Increament>0;Increament/=2)
14 {
15
16 for (i=Increament;i<N;i++)
17 {
18 Tmp=A[i];
19
20 for(j=i;j>=Increament;j-=Increament)
21 {
22 if(Tmp<A[j-Increament])
23
24 A[j]=A[j-Increament];
25
26 else
27 break;
28 A[j-Increament]=Tmp;
29
30 }
31
32
33 }
34 }
35 printf("\n");
36 for ( t=0;t<10;t++)
37 {
38 printf("%5d",A[t]);
39 }
40
41 }