数据结构C实现排序:直接插入、归并和快速排序(递增)学号 联系客服

发布时间 : 星期三 文章数据结构C实现排序:直接插入、归并和快速排序(递增)学号更新完毕开始阅读c3e84310747f5acfa1c7aa00b52acfc788eb9f0c

if(Left+Cutoff<=Right) {

Pivot=Median3(A,Left,Right); i=Left;j=Right-1; for(;;) {

while(strcmp(A[++i].name,Pivot.name)<0){} while(strcmp(A[--j].name,Pivot.name)>0){} if(i

Swap(&A[i],&A[j]); else

break; }

Swap(&A[i],&A[Right-1]); Qsort(A,Left,i-1); Qsort(A,i+1,Right); } else

InsertionSort2(A+Left,Right-Left+1); }

void PrintInfo() {

int i;

printf(\学号ID 姓名 分数\\n\ for(i=0;i<12;i++) {

printf(\ printf(\ printf(\ } }

void main() {

printf(\原顺序为:\\n\\n\ PrintInfo();

printf(\用插入法排序为:\\n\\n\ InsertionSort(StuInfo,12); PrintInfo();

printf(\用归并法排序为:\\n\\n\ Mergsort(StuInfo,12); PrintInfo();

printf(\用快速法排序为:\\n\\n\ Qsort(StuInfo,0,11); PrintInfo();

}

(注:专业文档是经验性极强的领域,无法思考和涵盖全面,素材和资料部分来自网络,供参考。可复制、编制,期待你的好评与关注)