//算法8.3 希尔排序 #include using namespace std; #define MAXSIZE 20 //顺序表的最大长度 typedef struct { int key; char *otherinfo; }ElemType; //顺序表的存储结构 typedef struct { ElemType *r; //存储空间的基地址 int length; //顺序表长度 }SqList; //顺序表类型 void ShellInsert(SqList &L,int dk) { //对顺序表L做一趟增量是dk的希尔插入排序 int i,j; for(i=dk+1;i<=L.length;++i) if(L.r[i].key0&& L.r[0].key>n; //输入个数 cout<<"请输入待排序的数据:\n"; while(n>MAXSIZE) { cout<<"个数超过上限,不能超过"<>n; } for(i=1;i<=n;i++) { cin>>L.r[i].key; L.length++; } } void show(SqList L) { int i; for(i=1;i<=L.length;i++) cout<>t; for(i=0;i>dt[i]; } ShellSort(L,dt,t); cout<<"排序后的结果为:"<