欢迎来到天天文库
浏览记录
ID:17416218
大小:24.84 KB
页数:15页
时间:2018-08-31
《数据结构航班管理系统》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、#include#include#include#definemaxspace100#definekeylen7#defineradix_n10#defineradix_c26typedefcharkeytype;typedefstruct{charstart[6];charend[6];charsche[10];chartime1[5];chartime2[5];charmodel[4];intprice;}infotype;typedefstruct{keytype
2、keys[keylen];infotypeothers;intnext;}slnode;typedefstruct{slnodesl[maxspace];intkeynum;intlength;}sllist;typedefintarrtype_n[radix_n];typedefintarrtype_c[radix_c];voiddistribute(slnode*sl,inti,arrtype_nf,arrtype_ne){intj,p;for(j=0;j3、l[0].next;p;p=sl[p].next){j=sl[p].keys[i]%48;if(!f[j])f[j]=p;elsesl[e[j]].next=p;e[j]=p;}}voidcollect(slnode*sl,inti,arrtype_nf,arrtype_ne){intj,t;for(j=0;!f[j];j++);sl[0].next=f[j];t=e[j];while(j4、;t=e[j];}}sl[t].next=0;}voidradixsort(sllist&l)//链式{inti;arrtype_nfn,en;arrtype_cfc,ec;for(i=0;i=2;i--){distribute(l.sl,i,fn,en);collect(l.sl,i,fn,en);}for(i=1;i>=0;i--){distribute_c(l.sl,i,fc,e5、c);collect_c(l.sl,i,fc,ec);}}voidarrange(sllist&l)//重新整理{intp,q,i;slnodetemp;p=l.sl[0].next;for(i=1;i6、tlow,high,mid;low=1;high=l.length;while(low<=high){mid=(low+high)/2;if(strcmp(key,l.sl[mid].keys)==0)returnmid;elseif(strcmp(key,l.sl[mid].keys)<0)high=mid-1;elselow=mid+1;}return0;}voidseqsearch(sllistl,keytypekey[],inti){intj,k,m=0;printf("************************7、*************************************");printf("*航班号起点站终点站航班期起飞时间到达时间机型票价*");for(j=1;j<=l.length;j++){switch(i){case2:k=strcmp(key,l.sl[j].others.start);break;case3:k=strcmp(key,l.sl[j].others.end);break;case4:k=strcmp(key,l.sl[j].others.time1);break;case5:k=str8、cmp(key,l.sl[j].others.time2);break;}if(k==0){m=1;printf("*%-8s%-7s%-6s%-11s%-9s%-7s%-5s%4d*",l.sl[j].keys,l.sl[j].others.start,l.sl[j].
3、l[0].next;p;p=sl[p].next){j=sl[p].keys[i]%48;if(!f[j])f[j]=p;elsesl[e[j]].next=p;e[j]=p;}}voidcollect(slnode*sl,inti,arrtype_nf,arrtype_ne){intj,t;for(j=0;!f[j];j++);sl[0].next=f[j];t=e[j];while(j4、;t=e[j];}}sl[t].next=0;}voidradixsort(sllist&l)//链式{inti;arrtype_nfn,en;arrtype_cfc,ec;for(i=0;i=2;i--){distribute(l.sl,i,fn,en);collect(l.sl,i,fn,en);}for(i=1;i>=0;i--){distribute_c(l.sl,i,fc,e5、c);collect_c(l.sl,i,fc,ec);}}voidarrange(sllist&l)//重新整理{intp,q,i;slnodetemp;p=l.sl[0].next;for(i=1;i6、tlow,high,mid;low=1;high=l.length;while(low<=high){mid=(low+high)/2;if(strcmp(key,l.sl[mid].keys)==0)returnmid;elseif(strcmp(key,l.sl[mid].keys)<0)high=mid-1;elselow=mid+1;}return0;}voidseqsearch(sllistl,keytypekey[],inti){intj,k,m=0;printf("************************7、*************************************");printf("*航班号起点站终点站航班期起飞时间到达时间机型票价*");for(j=1;j<=l.length;j++){switch(i){case2:k=strcmp(key,l.sl[j].others.start);break;case3:k=strcmp(key,l.sl[j].others.end);break;case4:k=strcmp(key,l.sl[j].others.time1);break;case5:k=str8、cmp(key,l.sl[j].others.time2);break;}if(k==0){m=1;printf("*%-8s%-7s%-6s%-11s%-9s%-7s%-5s%4d*",l.sl[j].keys,l.sl[j].others.start,l.sl[j].
4、;t=e[j];}}sl[t].next=0;}voidradixsort(sllist&l)//链式{inti;arrtype_nfn,en;arrtype_cfc,ec;for(i=0;i=2;i--){distribute(l.sl,i,fn,en);collect(l.sl,i,fn,en);}for(i=1;i>=0;i--){distribute_c(l.sl,i,fc,e
5、c);collect_c(l.sl,i,fc,ec);}}voidarrange(sllist&l)//重新整理{intp,q,i;slnodetemp;p=l.sl[0].next;for(i=1;i6、tlow,high,mid;low=1;high=l.length;while(low<=high){mid=(low+high)/2;if(strcmp(key,l.sl[mid].keys)==0)returnmid;elseif(strcmp(key,l.sl[mid].keys)<0)high=mid-1;elselow=mid+1;}return0;}voidseqsearch(sllistl,keytypekey[],inti){intj,k,m=0;printf("************************7、*************************************");printf("*航班号起点站终点站航班期起飞时间到达时间机型票价*");for(j=1;j<=l.length;j++){switch(i){case2:k=strcmp(key,l.sl[j].others.start);break;case3:k=strcmp(key,l.sl[j].others.end);break;case4:k=strcmp(key,l.sl[j].others.time1);break;case5:k=str8、cmp(key,l.sl[j].others.time2);break;}if(k==0){m=1;printf("*%-8s%-7s%-6s%-11s%-9s%-7s%-5s%4d*",l.sl[j].keys,l.sl[j].others.start,l.sl[j].
6、tlow,high,mid;low=1;high=l.length;while(low<=high){mid=(low+high)/2;if(strcmp(key,l.sl[mid].keys)==0)returnmid;elseif(strcmp(key,l.sl[mid].keys)<0)high=mid-1;elselow=mid+1;}return0;}voidseqsearch(sllistl,keytypekey[],inti){intj,k,m=0;printf("************************
7、*************************************");printf("*航班号起点站终点站航班期起飞时间到达时间机型票价*");for(j=1;j<=l.length;j++){switch(i){case2:k=strcmp(key,l.sl[j].others.start);break;case3:k=strcmp(key,l.sl[j].others.end);break;case4:k=strcmp(key,l.sl[j].others.time1);break;case5:k=str
8、cmp(key,l.sl[j].others.time2);break;}if(k==0){m=1;printf("*%-8s%-7s%-6s%-11s%-9s%-7s%-5s%4d*",l.sl[j].keys,l.sl[j].others.start,l.sl[j].
此文档下载收益归作者所有