资源描述:
《c语言各种排序源代码》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、[C语言]各种排序—你都会吗(计数排序,基数排序,快速排序,...)[复制链接]raotfraotf当前离线主题17帖子298精华1积分1313C币1093枚在线时间220小时注册时间2010-6-5最后登录2011-10-7性别男居住地福建省 漳州市版主主题17帖子298C币1093枚在线时间220小时·串个门·加好友·打招呼·发消息共包含"插入排序","快速排序","归并排序","冒泡排序","选择排序","希尔排序","计数排序","基数排序","堆排序 "1.#include2.#include3.
2、#include4.#include5.#include6.#include7.8.//把函数名,变量名和母语(拼音)联想下,别跟英语想一块去了~~~~9.10.#defineMAX 123456 //长度11.#definePAIXU_CHARU 0 //插入排序12.#definePAIXU_KUAISU 1 //快速排序13.#definePAIXU_GUIBING 2 //归并排序14.#
3、definePAIXU_MAOPAO 3 //冒泡排序15.#definePAIXU_XUANZE 4 //选择排序16.#definePAIXU_XIER 5 //希尔排序17.#definePAIXU_YIERSAN 6 //计数排序18.#definePAIXU_GESHIBAI 7 //基数排序19.#definePAIXU_DUI 8 //堆排序20.#definePAIXU_QSORT 9 //qsort函数21
4、.22.#defineFANGFASHU 10 //方法总数23.24.25.voiddata_shuchu(int*p,intleng); //打印数组26.voiddata_fuzhi(int*p,int*data,intleng); //拷贝数组1.2.voidpaixu_maopao(int*p,intleng,int(*cmp)(constvoid*a,constvoid*b));3.voidpaixu_xuanze(int*p,intleng,int(*cmp)(constvoid*a,constvoid*b));
5、4.voidpaixu_charu(int*p,intleng,int(*cmp)(constvoid*a,constvoid*b)); 5.voidpaixu_kuaisu(int*p,intleng,int(*cmp)(constvoid*a,constvoid*b));6.voidpaixu_xier(int*p,intleng,int(*cmp)(constvoid*a,constvoid*b));7.voidpaixu_geshibai(int*p,intleng,int(*cmp)(constvoid*a,constvoid*b))
6、;8.voidpaixu_dui(int*p,intleng,int(*cmp)(constvoid*a,constvoid*b));9.int*paixu_guibing(int*p,intleng,int(*cmp)(constvoid*a,constvoid*b));10.int*paixu_yiersan(int*p,intleng,int(*cmp)(constvoid*a,constvoid*b));11.int*guibing_hebing(int*zuo_data,intzuo_leng,int*you_data,intyou_l
7、eng,int(*cmp)(constvoid*a,constvoid*b));12.int kuaisu_dingwei(int*p,inttou,intwei,int(*cmp)(constvoid*a,constvoid*b));13.voiddui_jian(int*p,ints,intleng,int(*cmp)(constvoid*a,constvoid*b));14.//上面是各种不同排序的实现函数15.// int*p----要排序的数组16.// intleng-----数组的长度17.// int(*cmp)(cons
8、tvoid*a,constvoid*b)-------排序方法函数的指针18.19.20.int paixu_fangfa(const