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

整人关不掉的网站怎么做广东省网站免备案表

整人关不掉的网站怎么做,广东省网站免备案表,完全可定制的软件,wordpress hook机制目录 1 - 选择排序 1.1 - 基本思想 1.2 - 直接选择排序 1.2.1 - 代码实现 1.3 - 堆排序 1.3.1 - 代码实现 1 - 选择排序 1.1 - 基本思想 每一次从待排序的数据元素中选出最小(或最大)的一个元素#xff0c;存放在序列的起始位置…目录 1 - 选择排序 1.1 - 基本思想 1.2 - 直接选择排序 1.2.1 - 代码实现 1.3 - 堆排序 1.3.1 - 代码实现 1 - 选择排序 1.1 - 基本思想 每一次从待排序的数据元素中选出最小(或最大)的一个元素存放在序列的起始位置直到全部待排序的数据元素排完。 1.2 - 直接选择排序 在元素集合arr[i] -- arr[n - 1]中选择关键码最大(或最小)的数据元素若它不是这组元素中的最后一个(或第一个)元素则将它与这组元素中的最后一个(或第一个)元素交换在剩余的arr[i] -- arr[n - 2] (arr[i 1] -- arr[n - 1]) 集合中重复上述步骤直到集合剩余1个元素 直接选择排序的特性总结 好理解但效率不是很好实际中很少使用时间复杂度空间复杂度稳定性不稳定 1.2.1 - 代码实现 #define _CRT_SECURE_NO_WARNINGS 1#includestdio.h #includestdlib.h #includestdbool.h// 交换 void Swap(int* x, int* y) {int tmp *x;*x *y;*y tmp; }// 打印 void PrintArray(int* a, int n) {for (int i 0; i n; i)printf(%d , a[i]);printf(\n); }// 选择排序 void SelectSort(int* a, int n) {int begin 0, end n - 1;while (begin end){int maxi begin, mini begin;for (int i begin; i end; i){if (a[i] a[maxi]){maxi i;}if (a[i] a[mini]){mini i;}}Swap(a[begin], a[mini]);// 如果maxi和begin重叠修正一下即可if (begin maxi){maxi mini;}Swap(a[end], a[maxi]);begin;--end;} }void TestSelectSort() {int a[] { 9, 2, 6, 1, 7, 3 ,0, 5, 8, 4 };PrintArray(a, sizeof(a) / sizeof(int));SelectSort(a, sizeof(a) / sizeof(int));PrintArray(a, sizeof(a) / sizeof(int)); }int main() {TestSelectSort();return 0; } 1.3 - 堆排序 堆排序(Heapsort)是指利用堆积树堆这种数据结构所设计的一种排序算法它是选择排序的一种。它是通过堆来进行选择数据。需要注意的是排升序要建大堆排降序建小堆。 堆排序特性总结 堆排序用堆来选数效率较高时间复杂度空间复杂度稳定性不稳定 1.3.1 - 代码实现 #define _CRT_SECURE_NO_WARNINGS 1#includestdio.h #includestdlib.h #includestdbool.h// 交换 void Swap(int* x, int* y) {int tmp *x;*x *y;*y tmp; }// 打印 void PrintArray(int* a, int n) {for (int i 0; i n; i)printf(%d , a[i]);printf(\n); }// 堆排序 void AdjustUp(int* a, int child) {int father (child - 1) / 2;while (child 0){if (a[child] a[father]){Swap(a[child], a[father]);//更新下标child father;father (father - 1) / 2;}else{break;//一旦符合小堆了就直接退出}} }void AdjustDown(int* a, int n, int parent) {int child parent * 2 1;while (child n){// 找出小的那个孩子if (child 1 n a[child 1] a[child]){child;}if (a[child] a[parent]){Swap(a[child], a[parent]);parent child;child parent * 2 1;}else{break;}} }// 排升序 void HeapSort(int* a, int n) {// 建大堆for (int i (n - 1 - 1) / 2; i 0; --i){AdjustDown(a, n, i);}int end n - 1;while (end 0){Swap(a[0], a[end]);AdjustDown(a, end, 0);--end;} }void TestHeapSort() {int a[] { 9, 2, 6, 1, 7, 3 ,0, 5, 8, 4 };PrintArray(a, sizeof(a) / sizeof(int));HeapSort(a, sizeof(a) / sizeof(int));PrintArray(a, sizeof(a) / sizeof(int)); }int main() {TestHeapSort();return 0; } 感谢大佬们的支持 互三啦
http://www.w-s-a.com/news/541534/

相关文章:

  • 网站设计素材edu域名网站
  • 中山学校的网站建设wordpress文章图片显示不出
  • 兰溪城市建设规划网站网站联盟的基本流程
  • 免费推广网站注册入口小说阅读网站怎么建设
  • 新网站怎么做网络推广怎么做企业网站排名
  • jsp商业网站开发网站链接如何做二维码
  • 江苏高校品牌专业建设网站怎么制作网站搜索窗口
  • 北京app建设 网站开发公司织梦网站seo
  • 大学网站 作风建设专题汽车配件外贸出口公司
  • 东莞做网站系统购物网站建设精英
  • 建设vip网站相关视频网站营销建设公司
  • 微站直播平台杭州seo按天计费
  • seo 新旧网站 两个域名福州设计网站建设
  • 如何做网站客户端如何做网络营销网站
  • 苏州网站建设制度打鱼网站建设
  • 瓜子二手车直卖网上海小红书seo
  • 天津中小企业网站制作珠海做网站的
  • 网站排名影响因素最牛的科技网站建设
  • 长春网站建设公司怎么样电商网站建设与开发期末考试
  • 品牌网站建设搭建国内外网站建设
  • 辽宁人社app一直更新整站seo定制
  • 兰州网站建设论坛装修品牌
  • 云南省城乡住房与建设厅网站用什么网站可以做电子书
  • 自己电脑怎么做网站服务器吗0基础如何做网站
  • 做网站的股哥网络整合营销方案策划
  • 网站你懂我意思正能量晚上唯品会网站开发费用
  • 网站认证金额怎么做分录网页无法访问是怎么回事
  • 樟木头建网站的wordpress自适应吸附菜单
  • 番禺网站设计威海微网站建设
  • 新乡网站建设服务网站建设的点子