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

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

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

代码说明:

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

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

发表评论

0 个回复

  • 研究生期间上《数值计》课的作业,所有代码都是C语言实现并调试通过,现在上传为大家服务。这是Seide迭代...
    研究生期间上《数值计算方法》课的作业,所有代码都是C语言实现并调试通过,现在上传为大家服务。这是Seide迭代算法-Seide iterative algorithm with C language
    2023-04-17 11:45:03下载
    积分:1
  • CRC32 calculation in C++
    CRC32计算算法采用C++语言,可用于嵌入式系统和GUI等应用。
    2022-03-05 00:31:47下载
    积分:1
  • 这是一个简单的演示如何评价文本的数学表达式
    This a simple demo of how to evaluate mathematical expressions in text format, including provision for variables and functions. The code consists of three simple classes: 1) Calc - which does the main calculations, 2) Stack - which is used to push and pop intermediate operators and numbers and 3) Symbol Table. The symbol table is a collection of calc symbols, a type structure consisting of various elements, including the expression name, function name, and the final value of the expression The evaluation procedure is done in three steps: 1) simplify the expression by removing all the elements within () and storing them in subexpressions within the symbol table. 2) Each of these sub expressions are then converted to RPN format (Reverse polar notation) and evaluated 3) Finally, the main expression is converted to RPN and evaluated-This is a simple demo of how to evaluate mathematical expressions in text format, including provision for variables and functi
    2022-02-20 06:26:41下载
    积分:1
  • 高斯消去的类
    C++编写高斯消去法求解线性方程组,将程序include到主程序,然后建立Guss对象,求解可得到最终解,奇异矩阵将会出错!
    2022-03-07 20:42:44下载
    积分:1
  • VB matrix eigenvalue of the algorithm sets. Including : symmetric matrix Jacobia...
    用VB实现矩阵特征值的求解算法集。包括:对称矩阵的雅可比变换,实对称阵为三对角阵的特征值求解,等五种特征值求解算法。-VB matrix eigenvalue of the algorithm sets. Including : symmetric matrix Jacobian transform, real symmetric matrix to a three-diagonal matrix eigenvalue solution, the five eigenvalue algorithm.
    2023-05-05 06:25:03下载
    积分:1
  • c语言实现业务逻辑与分离的单链表
    传统单链表的算法实现不能满足企业应用,企业里使用的链表实现是经过改良的,实现了算法和业务逻辑的分离(这里是重点,也只有这样才能被实际使用,如果你是传统的实现方式在使用的话,建议看看这里的实现思想),所以实现与传统的方法也不一样。具体实现直接看代码,注意与传统链表的实现接口destory和clear,以及调用方式有很大的不同,可能需要慢慢理解
    2023-08-26 01:00:03下载
    积分:1
  • 大数加、减、乘和除的C语言实现源码,可以帮助实现大数运。...
    大数加法、减法、乘法和除法的C语言实现源码,可以帮助实现大数运算。-Addition of large numbers, subtraction, multiplication and division of the C language source code that can help realize computation of large numbers.
    2023-08-21 06:30:03下载
    积分:1
  • encryption decryption
    它是一种信息加密技术,它为我们的信息提供了安全性,它将纯文本转换成密文,并在此基础上以5*5的块排列
    2023-05-16 10:45:02下载
    积分:1
  • 人工智能A*求解八数码
    运行环境说明(2013.11.22) 1.操作系统: ubuntu 13.10 2.集成开发环境: geany-1.23.1 + gcc-4.8.1 3.由于linux操作系统与windows操作系统采用不同的编码格式,在windows下查看相关文档或源代码可能会有乱码问题,如需调试运行,请迁移到相关环境。
    2022-08-18 17:06:11下载
    积分:1
  • 顺序表和链表的应用
    掌握线性表的基本操作(插入、删除、查找)以及线性表合并等运算在顺序存储结构、链式存储结构上的实现。重点掌握链式存储结构实现的各种操作。掌握线性表的链式存储结构的应用
    2023-03-16 22:25:19下载
    积分:1
  • 696516资源总数
  • 106918会员总数
  • 4今日下载