欢迎来到天天文库
浏览记录
ID:34470021
大小:71.00 KB
页数:16页
时间:2019-03-06
《插入排序希尔排序快速排序冒泡排序c算法》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、//排序#includeintpartions(intl[],intlow,inthigh){intprvotkey=l[low];l[0]=l[low];while(low=prvotkey)--high;l[low]=l[high];while(low2、gh){intprvotloc;if(lowintpartions(intl[],intlow,inthigh){intprvotkey=l[low];l[0]=l[low];while(low=prvotkey)--high;l[low]=l[high];while(low3、y)++low;l[high]=l[low];}l[low]=l[0];returnlow;}voidqsort(intl[],intlow,inthigh){intprvotloc;if(lowintpartions(intl[],intlow,inthigh){intprvotkey=l[low];l[0]=l[low];while(low4、igh&&l[high]>=prvotkey)--high;l[low]=l[high];while(lowintpartions(intl[5、],intlow,inthigh){intprvotkey=l[low];l[0]=l[low];while(low=prvotkey)--high;l[low]=l[high];while(low6、partions(l,low,high);//将第一次排序的结果作为枢轴16//排序#includeintpartions(intl[],intlow,inthigh){intprvotkey=l[low];l[0]=l[low];while(low=prvotkey)--high;l[low]=l[high];while(low7、turnlow;}voidqsort(intl[],intlow,inthigh){intprvotloc;if(low8、排到第n个}voidmain(){inta[11]={0,2,32,43,23,45,36,57,14,27,39};for(intb=1;b<11;b++)printf("%3d",a[b]);printf("");quicksort(a,11);for(intc=1;
2、gh){intprvotloc;if(lowintpartions(intl[],intlow,inthigh){intprvotkey=l[low];l[0]=l[low];while(low=prvotkey)--high;l[low]=l[high];while(low3、y)++low;l[high]=l[low];}l[low]=l[0];returnlow;}voidqsort(intl[],intlow,inthigh){intprvotloc;if(lowintpartions(intl[],intlow,inthigh){intprvotkey=l[low];l[0]=l[low];while(low4、igh&&l[high]>=prvotkey)--high;l[low]=l[high];while(lowintpartions(intl[5、],intlow,inthigh){intprvotkey=l[low];l[0]=l[low];while(low=prvotkey)--high;l[low]=l[high];while(low6、partions(l,low,high);//将第一次排序的结果作为枢轴16//排序#includeintpartions(intl[],intlow,inthigh){intprvotkey=l[low];l[0]=l[low];while(low=prvotkey)--high;l[low]=l[high];while(low7、turnlow;}voidqsort(intl[],intlow,inthigh){intprvotloc;if(low8、排到第n个}voidmain(){inta[11]={0,2,32,43,23,45,36,57,14,27,39};for(intb=1;b<11;b++)printf("%3d",a[b]);printf("");quicksort(a,11);for(intc=1;
3、y)++low;l[high]=l[low];}l[low]=l[0];returnlow;}voidqsort(intl[],intlow,inthigh){intprvotloc;if(lowintpartions(intl[],intlow,inthigh){intprvotkey=l[low];l[0]=l[low];while(low4、igh&&l[high]>=prvotkey)--high;l[low]=l[high];while(lowintpartions(intl[5、],intlow,inthigh){intprvotkey=l[low];l[0]=l[low];while(low=prvotkey)--high;l[low]=l[high];while(low6、partions(l,low,high);//将第一次排序的结果作为枢轴16//排序#includeintpartions(intl[],intlow,inthigh){intprvotkey=l[low];l[0]=l[low];while(low=prvotkey)--high;l[low]=l[high];while(low7、turnlow;}voidqsort(intl[],intlow,inthigh){intprvotloc;if(low8、排到第n个}voidmain(){inta[11]={0,2,32,43,23,45,36,57,14,27,39};for(intb=1;b<11;b++)printf("%3d",a[b]);printf("");quicksort(a,11);for(intc=1;
4、igh&&l[high]>=prvotkey)--high;l[low]=l[high];while(lowintpartions(intl[
5、],intlow,inthigh){intprvotkey=l[low];l[0]=l[low];while(low=prvotkey)--high;l[low]=l[high];while(low6、partions(l,low,high);//将第一次排序的结果作为枢轴16//排序#includeintpartions(intl[],intlow,inthigh){intprvotkey=l[low];l[0]=l[low];while(low=prvotkey)--high;l[low]=l[high];while(low7、turnlow;}voidqsort(intl[],intlow,inthigh){intprvotloc;if(low8、排到第n个}voidmain(){inta[11]={0,2,32,43,23,45,36,57,14,27,39};for(intb=1;b<11;b++)printf("%3d",a[b]);printf("");quicksort(a,11);for(intc=1;
6、partions(l,low,high);//将第一次排序的结果作为枢轴16//排序#includeintpartions(intl[],intlow,inthigh){intprvotkey=l[low];l[0]=l[low];while(low=prvotkey)--high;l[low]=l[high];while(low7、turnlow;}voidqsort(intl[],intlow,inthigh){intprvotloc;if(low8、排到第n个}voidmain(){inta[11]={0,2,32,43,23,45,36,57,14,27,39};for(intb=1;b<11;b++)printf("%3d",a[b]);printf("");quicksort(a,11);for(intc=1;
7、turnlow;}voidqsort(intl[],intlow,inthigh){intprvotloc;if(low8、排到第n个}voidmain(){inta[11]={0,2,32,43,23,45,36,57,14,27,39};for(intb=1;b<11;b++)printf("%3d",a[b]);printf("");quicksort(a,11);for(intc=1;
8、排到第n个}voidmain(){inta[11]={0,2,32,43,23,45,36,57,14,27,39};for(intb=1;b<11;b++)printf("%3d",a[b]);printf("");quicksort(a,11);for(intc=1;
此文档下载收益归作者所有