登录
首页 » 算法 » 堆排序算法实例C实现代码

堆排序算法实例C实现代码

于 2022-01-25 发布 文件大小:1.06 kB
0 359
下载积分: 2 下载次数: 1

代码说明:

应用背景 该问题是这样描述的:找n个数中的前k个最小数,要求时间复杂度和空间复杂度尽可能低。(n可能很大) 据说这是一些知名公司的面试题目。题目看起来简单,就区区二十来字,但是要求却不低。这里面蕴含的算法思想在金融等领域的软件中都有应用。在此分享,希望能给同仁们一些参考。 关键技术本实例中主要是通过堆排序来实现的,堆排序算法的实现中的难点在于对堆的调整,无论是最大堆还是最小堆,在具体应用中都会维持着一种动而不乱的结构。这里面还用到桶排序的思想,其实它也是建立在堆排序基础上的。C语言实现的代码看起来简洁明了。

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

发表评论

0 个回复

  • 项目实施的堆
    函数和过程: 1.Heapify 2.建堆 3.插入 4.提取最大 5.增加的关键 6.初始化 7.打印堆 从文件堆成 8.读取文本)
    2023-02-08 06:50:03下载
    积分:1
  • Was established based on moving least square (Moving Least
    建立了一种基于移动最小二乘(Moving Least-Squares MLS)法的曲线曲 面拟合方法 这种方法对传统的最小二乘(LS)法的作了比较大的改进 使生成的曲线曲面具 有精度高 光滑性好等许多优点 详细介绍了移动最小二乘法的原理 应用和特点 并且给 出了使用移动最小二乘法进行曲线曲面拟合的程序设计流程 最后给出了曲线拟合和空间散 乱数据曲面拟合算例 将拟合结果与最小二乘拟合结果作了比较 分析了 MLS 拟合曲线曲 面的光滑性和拟合质量 表明了该方法的优越性和有效性-Was established based on moving least square (Moving Least-Squares MLS) method of this curve and surface fitting method to the traditional method of least squares (LS) method was relatively large improvements to make the generated curves and surfaces with a precision of High smoothness, good detail, and many other advantages of the principle of least-squares method for mobile applications and features and gives the least-squares method using the mobile curve and surface fitting procedure design process Finally, curve fitting and spatial scattered data surface to be cost-effective cases of the results of the fitting results are compared with the least-squares fitting analysis of MLS fitting curves and surfaces smooth and fitting quality demon
    2023-02-17 12:50:04下载
    积分:1
  • 差分进化
    Differential evolution: A simple and efficient heuristic for global optimization over continuous spaces. This code implements a basic multi-objective optimization algorithm based on Diferential Evolution (DE) algorithm. When one objective is optimized, the standard DE runs; if two or more objectives are optimized, the greedy selection step in DE algorithm is performed using a dominance relation.
    2022-07-08 18:06:29下载
    积分:1
  • 矩阵运
    矩阵运算--Matrix calculation
    2022-02-01 09:38:52下载
    积分:1
  • procedures for the three mixed vector plot calculated using Matlab to achieve
    本程序提供三矢量混合积的计算,采用matlab实现-procedures for the three mixed vector plot calculated using Matlab to achieve
    2022-10-23 12:45:03下载
    积分:1
  • AOE网,VC实现
    AOE网算法,VC实现-AOE network algorithm, VC
    2022-03-05 23:14:20下载
    积分:1
  • dijkstra求最短路
    dijkstra求最短路:最短路问题是重要的最优化问题之一,它不仅可以直接应用于解决实际的许多问题,如管道铺设、线路安排、厂区布局、设备更新等,而且经常被作为一个基本工 具,用于解决其他问题。对于两点间的距离大于或者等于0的问题而言,目前公认的最好的方法是由Dijkstra于1959年提出来的。
    2022-09-09 03:25:03下载
    积分:1
  • 汇编语言十六进制转化为二进制和十进制显示
    使用汇编语言,将十六进制转化为二进制和十进制并输出显示。从键盘输入一个2位无符号的16进制数(00H~FFH),然后在显示器上同时以二进制和十进制形式显示出来。例如:  Pleaseinput N(00H-FFH): 9B          N= 9BH = 10011011B = 155
    2022-04-24 21:29:11下载
    积分:1
  • FastICA by cc++
    fastica C++实现,很简单的,很容易看的 
    2022-02-25 19:09:15下载
    积分:1
  • 本程序可以对那些数值超出整形的大整数进行+
    本程序可以对那些数值超出整形的大整数进行+ - * % 运算欢迎大家使用并提出宝贵修改意见 -the procedures for those values beyond the plastic for the integer-*% Operational Everyone is welcome to use and valuable changes
    2023-08-29 06:50:02下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载