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

网站页面怎么做地图酒仙桥网站建设

网站页面怎么做地图,酒仙桥网站建设,自己做的电影网站打开很慢,做网站电话目录😋 任务描述 测试说明 我的通关代码: 测试结果: 任务描述 本关任务:实现快速排序算法。 测试说明 平台会对你编写的代码进行测试: 测试输入示例: 10 6 8 7 9 0 1 3 2 4 5 (说明:第一行是元素个数&a…

目录😋

任务描述

测试说明

我的通关代码:

测试结果:


任务描述

本关任务:实现快速排序算法。

测试说明

平台会对你编写的代码进行测试:

测试输入示例:
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.yayakq.cn/news/593755/

相关文章:

  • 网站变慢的原因网站建设鼠标滑动效果
  • 怎么做卖橘子的网站可以刮刮卡的网站
  • 央企网站群建设怎样建免费网站
  • 网站建设哪家较好外卖网站怎么做
  • 仿4493美图网站程序南京建设监理协会网站
  • 推广网站怎么建设和维护logo设计vi
  • 教育网站建设网有关网站开发的参考文献
  • 做网站基本东西官方网站旗舰店
  • 有没有做gif的专门网站网站标签布局
  • 搭建网站的企业洛阳网站建设设计公司哪家好
  • 工信部网站怎么查网址wordpress网盘搜索引擎插件
  • wordpress内链seo优化检测
  • 合肥有多少建网站公司济南住房和城乡建设部网站
  • 汶上云速网站建设域名在哪里续费
  • 做网站好的网站建设公司排名北京网站建设学习
  • 常州网站公司网站定制高端网站建设
  • 织梦wap网站想学广告设计没有基础
  • html5国内网站什么网站做外贸最好
  • 如何做自己公司网站互联网网站项目方案书
  • 做网站的是什么职位如何创建微网站
  • 哪里做网站最便宜软件工程师的薪资待遇
  • 网站怎么做 流程图做网站需要的信息
  • 在哪个网站做旅游攻略好小程序 微网站
  • 彩票类网站开发许昌网站开发公司
  • 织梦网站关闭手机版湖南正规网络营销哪家便宜
  • 深圳做网站推广哪家好注册科技公司需要什么条件
  • 湖南常德广宇建设网站建设网站需要哪些条件
  • 网站建设的目的与意义是什么意思越城区建设和交通运输局网站
  • 网站备案是指什么网站桌面图标怎么做
  • 企业站seo价格宁波网络推广培训