当前位置: 首页 > news >正文

免费购物网站程序红酒企业网站模板

免费购物网站程序,红酒企业网站模板,网站开发维护人员,建设通官网通目录#x1f60b; 任务描述 测试说明 我的通关代码: 测试结果#xff1a; 任务描述 本关任务#xff1a;实现快速排序算法。 测试说明 平台会对你编写的代码进行测试#xff1a; 测试输入示例#xff1a; 10 6 8 7 9 0 1 3 2 4 5 (说明#xff1a;第一行是元素个数 任务描述 测试说明 我的通关代码: 测试结果 任务描述 本关任务实现快速排序算法。 测试说明 平台会对你编写的代码进行测试 测试输入示例 10 6 8 7 9 0 1 3 2 4 5 (说明第一行是元素个数第二行是待排序的原始关键字数据。 输出示例 排序前:6 8 7 9 0 1 3 2 4 5  第1次划分:  5  4  2  3  0  1  6  9  7  8 第2次划分:  1  4  2  3  0  5 第3次划分:  0  1  2  3  4 第4次划分:        2  3  4 第5次划分:           3  4 第6次划分:                       8  7  9 第7次划分:                       7  8 排序后:0 1 2 3 4 5 6 7 8 9  开始你的任务吧祝你成功 我的通关代码: #include malloc.h #include stdio.h#define MAXL 100 //最大长度 typedef int KeyType; //定义关键字类型为int typedef char InfoType;typedef struct {KeyType key; //关键字项InfoType data; //其他数据项类型为InfoType } RecType; //查找元素的类型void CreateList(RecType R[], KeyType keys[], int n) //创建顺序表 {for (int i 0; i n; i) // R[0..n-1]存放排序记录R[i].key keys[i]; } void DispList(RecType R[], int n) //输出顺序表 {for (int i 0; i n; i)printf(%d , R[i].key);printf(\n); }//显示一趟划分后的结果 void disppart(RecType R[], int s, int t) {/********** Begin *********/for (int i 0; i s; i)printf( );for (int i s; i t; i)printf(%3d , R[i].key);printf(\n);/********** End **********/ }//一趟划分 int partition(RecType R[], int s, int t) {/********** Begin *********/KeyType pivot R[s].key; // 从 RecType 中提取 key 字段while (s t) {while (s t R[t].key pivot)t--;R[s] R[t];while (s t R[s].key pivot)s;R[t] R[s];}R[s].key pivot; // 将 pivot 的值赋回 R[s].keyreturn s;/********** End **********/ }//对R[s..t]的元素进行递增快速排序 void QuickSort(RecType R[], int s, int t, int *count) {/********** Begin *********/int pivotpos;if (s t) {(*count); // 增加划分次数printf(第%d次划分:, *count); // 输出划分次数提示信息pivotpos partition(R, s, t);disppart(R, s, t);QuickSort(R, s, pivotpos - 1, count);QuickSort(R, pivotpos 1, t, count);}/********** End **********/ }int main() {/********** Begin *********/int n;scanf(%d, n);KeyType keys[MAXL];RecType R[MAXL];for (int i 0; i n; i)scanf(%d, keys[i]);CreateList(R, keys, n);printf(排序前:);DispList(R, n);int count 0; // 初始化划分次数QuickSort(R, 0, n - 1, count);printf(排序后:);DispList(R, n);/********** End **********/return 0; }测试结果
http://www.hkea.cn/news/14310311/

相关文章:

  • 轻云服务器菁英版 多个网站云南网页设计制作
  • 广州哪里有做网站的北京网站建设开发专业公司
  • 软件开发与网站建设个人网页设计模板教程
  • 美容行业网站建设方案高质量的南昌网站建设
  • 住房城乡建设局网站首页织梦网站图片修改不了
  • 成都网站建设租书网项目计划书模板范文 完整版
  • 郑州阿里巴巴网站建设民治网站设计圳网站建设公司
  • 过年做哪些网站致富地旺建设官方网站
  • 国内ui设计网站昆明网络营销服务公司
  • 网站网业设计建筑公司招聘岗位
  • 企业网站优化暴肃湖南岚鸿很好湖北随州住房和城乡建设部网站
  • 网站设计常用字体网站美编设计怎么做
  • 罗湖商城网站设计天津网站建设wangzhii
  • 省建设干部培训中心网站长春做网站好的公司
  • 贵州省城乡住房建设厅网站网站建设判断题
  • php响应式网站开发教程网络营销外包公司哪家最好
  • 中国机械加工网站官网天河做网站哪家强
  • 百度网页怎么做seo课程哪个好
  • 网站建设电话销售话术模板大全公众号开发收费价目表
  • 传销教你做网站外包公司的业务员
  • 哈尔滨网站优化对策岳阳seo招聘
  • 宜春市城乡规划建设局网站爱站网关键词查询网站
  • 网站搭建徐州百都网络搭建做网站没有数据
  • 做网站用个人还是企业比较好wordpress cros
  • 大型的网站后台用什么做php可视化网站开发工具
  • 中国建站平台建设部网站施工合同版本
  • 不用iis建立网站wordpress add_post_meta
  • 免费做微信链接的网站wordpress支付查看更多
  • 电脑网站转手机版西部数码网站管理助手 mysql
  • 全国建设教育联盟统一平台网站绿色风格网站