复制代码 代码如下:
#include
typedef struct {
int key;
}RecType;
typedef struct {
RecType R[100+1];
int Length;
}SqList;
#define N 11//为测试方便,直接输入11个整数
void InsertSort(SqList *L)
{
int i,j;
for(i=2;i<=L->Length;i++)
if(L->R[i].key
{
L->R[0]=L->R[i];
//value of under j compare with up decrease 1
for(j=i-1;L->R[0].key
L->R[j+1]=L->R[j];
L->R[j+1]=L->R[0];
}
}
int main()
{
SqList L;
int a[N],i,j,x;
for(i=1;i
L.Length=i-1;
InsertSort(&L);
for(i=1;i
printf("n");
return 0;
}



