>n; intr[n]; cout<<"输入整型数组r[n]各元素的值:"<>r[i]; }//输入数组r[n] CreatHeap(r,n);//建初堆 cout<<"将r[n]调整为大根堆-堆排序-c++ - IMDN开发者社群-imdn.cn" /> >n;intr[n];cout<<"输入整型数组r[n]各元素的值:"<>r[i];}//输入数组r[n]CreatHeap(r,n);//建初堆cout<<"将r[n]调整为大根堆,得:"<>k;//输入待删除的元素序号 Del(r,k,n);//删除第k个节点后重新调整堆,时间复杂度O(logn)cout<<"删除完毕"< >n;intr[n];cout<<"输入整型数组r[n]各元素的值:"<>r[i];}//输入数组r[n]CreatHeap(r,n);//建初堆cout<<"将r[n]调整为大根堆,得:"<>k;//输入待删除的元素序号 Del(r,k,n);//删除第k个节点后重新调整堆,时间复杂度O(logn)cout<<"删除完毕"<
登录
首页 » c++ » 堆排序

堆排序

于 2022-02-04 发布 文件大小:1.10 kB
0 103
下载积分: 2 下载次数: 1

代码说明:

堆排序算法,c++实现 主函数 int main(){ int n; cout

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • AVERAGE
    Computes pairwise averages of three numbers
    2008-12-07 00:41:01下载
    积分:1
  • The_oscilloscope_GUI
    简易数字示波器MATLAB实现,我自己写的,非常简陋,练习程序,还望见谅(Simple digital oscilloscope MATLAB implementation, I wrote it myself, very simple, exercise procedures, but also look forward to forgive me.)
    2018-10-22 22:04:46下载
    积分:1
  • ARM Cortex-M3与Cortex-M4权威指南(第3版)
    说明:  共3部分,1/3 本书介绍了ARM架构的背景知识以及指令集、中断处理等处理器特性,并描述了如何设置并利用存储器保护单元(MPU)等可用的高级特性。书中论述Keil MDK、IAR EWARM、gcc以及CooCoxCoIDET工具入门的章节可以给初学者在编写程序代码方面提供一些帮助,其中也包括一些重要的软件开发问题,比如低功耗特性的使用、信息输入/输出的处理、汇编和c语言的混合编程及其他高级技术话题。(This book introduces the background knowledge of arm architecture, instruction set, interrupt processing and other processor features, and describes how to set up and utilize the available advanced features such as memory protection unit (MPU). The chapters on keil MDK, IAR EWARM, GCC and coocox coidet tools in the book can provide some help for beginners in writing program code, including some important software development problems, such as the use of low-power features, information input / output processing, mixed programming of assembly and C language, and other advanced technical topics.)
    2021-01-16 23:01:27下载
    积分:1
  • RSAjiamijiemi
    实现可以对任意文件进行RSA加密操作的窗体应用程序。经过加密的文件以及密钥文件都是文本文件。(Can realize arbitrary files on the RSA encryption operation of the application form. After the encrypted files as well as the key file is a text file.)
    2008-04-01 07:33:50下载
    积分:1
  • Petzold.Media3D
    Petzold写的《精通windows 3D 图形程序设计》中推荐的源码。(Petzold wrote, " proficient in windows 3D graphics programming" in the recommended source.)
    2021-03-16 16:39:21下载
    积分:1
  • pipe
    某石油公司计划建造一条由东向西的主输油管道。该管道要穿过一个有n 口油井的油田。从每口油井都要有一条输油管道沿最短路经(或南或北)与主管道相连。如果给定n 口油井的位置,即它们的x 坐标(东西向)和y 坐标(南北向),应如何确定主管道的最优位置, 即使各油井到主管道之间的输油管道长度总和最小的位置?证明可在线性时间内确定主管道的最优位置。(An oil company plans to construct a east to west from the main pipeline. The pipeline to pass through an oil field n wells. Wells from each must have a pipeline along the shortest path (or South or North) connected with the competent Road. If given the location of oil wells in n, that is, their x coordinates (east-west) and y coordinates (north-south), should be how to determine the optimal position in charge of Road, even if the wells to the pipeline in charge of Road between the sum of the smallest length location? proved to be linear time to determine the optimal position in charge of Road.)
    2008-07-07 10:25:25下载
    积分:1
  • speedapp
    USB芯片CY7C68013 批量传输速度检测(Chip CY7C68013 USB bulk transfer speed detection)
    2011-05-21 22:54:16下载
    积分:1
  • chuandao12864
    串口发送数据,字符,12864接受并显示字符(Serial port to send data, the character, to accept and display the character 12864)
    2011-08-12 19:01:33下载
    积分:1
  • (first-follow-select)
    构造LL(1)语法分析程序,任意输入一个文法符号串,并判断它是否为文法的一个句子。程序要求为该文法构造预测分析表,并按照预测分析算法对输入串进行语法分析,判别程序是否符合已知的语法规则,如果不符合(编译出错),则输出错误信息(Construct LL (1) parser, enter an arbitrary string of grammar symbols, and determine if it is a sentence grammar. Procedural requirements for the grammar structure prediction analysis table, and in accordance with predictive analysis algorithms to parse input string, determine whether the program is consistent with the known rules of grammar, if you do not comply (compiler error), the error message is output)
    2014-11-14 21:21:28下载
    积分:1
  • c# 中的聊天程序
    c# 编程使用远程处理和 reflection。这种聊天包括一对一聊天、 广播聊天。在文件中有三个组件:服务器、 客户端和服务。server 必须运行在控制台国内外客户端必须从 application。service 部分在窗口中运行包含的代码,以向用户提供服务,为聊天,请注意应一次运行的服务器只有一个实例,否则它会给出错误。这个聊天程序代码的仅使用在本地计算机上,如果你想要使它具有普遍性对于任何机器来说,然后你要只更改 ip 部分,并替换机器的地址或换服务器。
    2022-02-06 12:41:18下载
    积分:1
  • 696518资源总数
  • 106235会员总数
  • 12今日下载