希尔排序

#include 
using namespace std;
#define  MAXSIZE  20                  
typedef struct{
    int key;
    char *otherinfo;
}ElemType;                       
typedef struct{
    ElemType *r;                                 
    int  length;                                
}SqList;                                        
//一趟增量是dk的希尔插入排序
void ShellInsert(SqList &L,int dk){
    int i,j;
    for(i=dk+1;i<=L.length;++i)
        if(L.r[i].key0&& L.r[0].key>n;                                    
    cout<<"待排序的数据:";
    for(i=1;i<=n;i++){
        cin>>L.r[i].key;
        L.length++;
    }
}
int main(){
    SqList L;
    L.r=new ElemType[MAXSIZE+1];
    L.length=0;
    Create_Sq(L);
    int i,t;
    int *dt=new int[MAXSIZE];
    cout<<"总趟数:";
    cin>>t;
    for(i=0;i>dt[i];
    }
    cout<<"希尔排序:\n";
    ShellSort(L,dt,t);
}

希尔排序_第1张图片

你可能感兴趣的:(数据结构,c++)