登录
首页 » 数据结构 » [问题描述] 将N个关键字去整数的记录进行整序, 以使所有关键字为非负数的记录排在关键字为负数的记录之前,要求使用最少的附加空间,且算法的时间复杂度为O(N...

[问题描述] 将N个关键字去整数的记录进行整序, 以使所有关键字为非负数的记录排在关键字为负数的记录之前,要求使用最少的附加空间,且算法的时间复杂度为O(N...

于 2022-03-17 发布 文件大小:7.42 kB
0 49
下载积分: 2 下载次数: 1

代码说明:

[问题描述] 将N个关键字去整数的记录进行整序, 以使所有关键字为非负数的记录排在关键字为负数的记录之前,要求使用最少的附加空间,且算法的时间复杂度为O(N) [输入] 待排序记录个数,各关键字的值。 [输出] 关键字从正负分开,正数在前 [存储结构] 待排序记录顺序存储。 [算法的基本思想] 快速排序算法每次任取一个记录的关键字为标准,将其余记录分为两组将,N个关键字去整数的记录进行整序, 以使所有关键字为非负数的记录排在关键字为负数的记录之前。 #include using namespace std #define MAXNUM 100//设文件的最长可能长度 void sort(int* keys, const int len)//排序 -[Problem Description] N keyword to the integer sequence the entire record. keyword so that all non-negative Records with the keyword for the negative record, at least require the use of the additional space and time complexity of the algorithm is O (N) [imported] to be sort record number, The value of the keyword. [Output] keyword separate from the pluses and minuses are several former [storage structure] scheduling records to be stored sequence. [Algorithm for the basic idea] quick sort algorithm each time a record for any keyword as a standard, The remaining records will be divided into two groups, N-keyword

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

发表评论

0 个回复

  • 这是一个分治解决的零件切割问题:给定一块宽度为W的矩形板,矩形板的高度不受限制。现需要从板上分别切割出n个高度为hi,宽度为wi的矩形零件。切割的规则是零件的高...
    这是一个分治解决的零件切割问题:给定一块宽度为W的矩形板,矩形板的高度不受限制。现需要从板上分别切割出n个高度为hi,宽度为wi的矩形零件。切割的规则是零件的高度方向与矩形板的高度方向保持一致。问如何切割使得所使用的矩形板的高度h最小?加上一个小界面-This is a solution to the partition cutting parts : a given width of the rectangular plate W, the height of rectangular plate unrestricted. Board is required from the respective cut out n height of the hi, wi width of the rectangular parts. Cutting parts to the rules of the height of the rectangular plate with a high degree of consistent direction. Asked how cutting makes use of the rectangular plate height h minimum? A small interface
    2022-06-11 21:05:53下载
    积分:1
  • VFP学生管理系统
    VFP学生管理系统,包括注册,管理以及数据统计-VFP student management system
    2022-04-06 09:25:46下载
    积分:1
  • K的隐私保护
    数据隐私保护K-匿名问题的动态多次发布类似m-invarience算法-Data Privacy Protection K-anonymity problem on many occasions issued a similar dynamic m-invarience algorithm
    2022-01-22 06:05:54下载
    积分:1
  • C语言课程设计,CAI系统,C语言课程设计,CAI系统...
    C语言课程设计,数据结构CAI系统,C语言课程设计,数据结构CAI系统-C language curriculum design, data structure CAI System,C language curriculum design, data structure CAI System,
    2023-01-15 20:35:04下载
    积分:1
  • VC做的药库管理系统,源程序和库都有。包括登陆框,连接库,操作库。...
    VC做的药库管理系统,源程序和数据库都有。包括登陆框,连接数据库,操作数据库。-VC do Drug Storehouse management systems, source code and databases are. Including landing box, connect to the database, the database.
    2023-04-30 13:00:02下载
    积分:1
  • 酒店管理
    感谢您下载...管理员 Id: 管理员管理员通过: 管理员邮寄到您的意见
    2022-02-01 14:49:39下载
    积分:1
  • Database Viewer application. Allows you to view and scroll through all of the re...
    Database Viewer application. Allows you to view and scroll through all of the records in a database.
    2022-03-11 02:23:14下载
    积分:1
  • STL算法实现的大整加减法的程序, 能够进行正负的加减,而且是动态组的, 因此可以无限输入,这是本人这学期的大作业
    STL算法实现的大整数加减法的程序, 能够进行正负数的加减,而且是动态数组的, 因此可以无限输入,这是本人这学期的大作业-STL algorithms and the largest integer addition and subtraction procedures, plus or minus a few to carry out addition and subtraction, but is a dynamic array, it can be unlimited importation, this is my semester of this operation
    2022-01-25 17:57:43下载
    积分:1
  • 贪吃蛇小游戏
    资源描述需要在Visual C++6.0的环境下,按照设计要求做一个贪吃蛇游戏,用户进入该游戏时可以进行选关,该游戏有三关,每一关的难度不同,吃到食物时得到的分数也会不同,界面会显示分数,在蛇碰到墙壁或者碰到自己时就会死亡。用户通过控制方向键便可控制蛇的方向。 Visual C++6.0开发环境是一个基于Windows操作系统的可视化、面向对象的集成开发环境。在该环境下用户可以开发有关C和C++的各种应用程序,应用程序包括建立、编辑、浏览、保存、编译、链接和调试等操作,这些操作都可以通过单击菜单选项或工具栏按钮来完成,使用方便、快捷。它还提供了项目工作区(WorkSpace)、应用程序向导(AppWizard)、类操作向导(ClassWizard)和WizardBar等实用编辑工具。
    2022-03-20 23:46:20下载
    积分:1
  • A Score ranking
    程序读取所有;
    2022-01-26 01:12:29下载
    积分:1
  • 696524资源总数
  • 103913会员总数
  • 34今日下载