ElementType ShellSort( ElementType A[], int N ) { for(int h=N/2;h>0;h/=3){ for(int i=h;i<N;i++){ ElementType key=A[i]; int j=i-h; for(;j>=0&&A[j]>key;j-=h) A[j+h]=A[j]; A[j+h]=key; } } } ElementType InsertSort( ElementType A[], int N ) { for(int i=1;i<N;i++){ ElementType key=A[i]; int j=i-1; for(;j>=0&&A[j]>key;j-=1) A[j+1]=A[j]; A[j+1]=key; } }