第8章 排序习题解析

发布时间 : 星期日 文章第8章 排序习题解析更新完毕开始阅读

these preous and worth cherishing. Second, scientific research situation, grasp the opportunities and challenges of transformation and upgrading of full completion of the \n-Five\s, start is crucial. Focused grand blueprint, must to history of thinking views trend, put associate times forward of pulse, stepped on associate economic law of drums, find associate transformation upgrade of path, in grasp macro trend in the advance science development; to strategy of vision conspiracy to global, always tight buckle national macro policy oriented, accurate grasp County love actual, based overall caught opportunities, and PCT thought, ensure County economic social development always along right track continued forward; to precision of measures seeking breakthrough, tightly pegged focus task and bottleneck restricted, Science and identify practical and effective measures, advance breakthrough, ensuring all tasks carry out to the letter; based on scientific assessment and strict implementation, persist in combining routine supervision and centralized supervision, accurate assessment Township departments, strictly cash rewards, prompted the departments own implementation at all levels. In working to advance, to truly grasp the Guide, seize the opportunity, finding a position and play to our strengths and take the initiative, ensure that the start of the new year tree, new performance. Grasp the Guide, is to dock in policy measures to seize the initiative. Accurate grasp of the Central Government, provinces and cities to speed up the development of new policies and new initiatives with a high degree of policy acumen to capture opportunities to accelerate development. Follow-up to promote the transformation and upgrading of the five great ideas offer a great chance. Five large development philosophy is the Party Central Committee with a view to promote economic transformation and upgrading, complete the building of a well-off society in major decisions and arrangements, is the development of a profound change. County-wide at all levels should conscientiously study and implement, implement the five ideas, green development, open development, on which to share advantages, and actively explore new path of innovative and coordinated developmentchanging the concept of leading the transformation of development mode of development, promote the development of quality improvement. Floor supply side structural reform implementation provides an effective strategy for improving the quality of development. Supply sidestructural reform is future full deepening reform of plays, to according to \policy to stability, and industry policy to associate, and micro policy to live, and reform policy to real, and social policy to backing\s, keen grasp Central, and provinces release out of new signal, combined County love actual accurate docking, full grasp \capacity, and to inventory, and to lever, and drop cost, and fill short Board\ntation, prompted County economic transformation upgrade, and continued upgrade. Poverty排序习题解析1 1. 填空题

⑴ 排序的主要目的是为了以后对已排序的数据元素进行( )。 【解答】查找

【分析】对已排序的记录序列进行查找通常能提高查找效率。

⑵ 对n个元素进行起泡排序,在( )情况下比较的次数最少,其比较次数为( )。在( )情况下比较次数最多,其比较次数为()。 【解答】正序,n-1,反序,n(n-1)/2

⑶ 对一组记录(54, 38, 96, 23, 15, 72, 60, 45, 83)进行直接插入排序,当把第7个记录60插入到有序表时,为寻找插入位置需比较( )次。 【解答】3

【分析】当把第7个记录60插入到有序表时,该有序表中有2个记录大于60。 ⑷ 对一组记录(54, 38, 96, 23, 15, 72, 60, 45, 83)进行快速排序,在递归调用中使用的栈所能达到的最大深度为( )。 【解答】3

⑸ 对n个待排序记录序列进行快速排序,所需要的最好时间是( ),最坏时间是( )。 【解答】O(nlog2n),O(n2)

⑹ 利用简单选择排序对n个记录进行排序,最坏情况下,记录交换的次数为( )。 【解答】n-1

【分析】60是该键值序列对应的完全二叉树中最后一个分支结点。 2. 选择题

⑴ 下述排序方法中,比较次数与待排序记录的初始状态无关的是( )。 A插入排序和快速排序 B归并排序和快速排序 C选择排序和归并排序 D插入排序和归并排序

these preous and worth cherishing. Second, scientific research situation, grasp the opportunities and challenges of transformation and upgrading of full completion of the \n-Five\s, start is crucial. Focused grand blueprint, must to history of thinking views trend, put associate times forward of pulse, stepped on associate economic law of drums, find associate transformation upgrade of path, in grasp macro trend in the advance science development; to strategy of vision conspiracy to global, always tight buckle national macro policy oriented, accurate grasp County love actual, based overall caught opportunities, and PCT thought, ensure County economic social development always along right track continued forward; to precision of measures seeking breakthrough, tightly pegged focus task and bottleneck restricted, Science and identify practical and effective measures, advance breakthrough, ensuring all tasks carry out to the letter; based on scientific assessment and strict implementation, persist in combining routine supervision and centralized supervision, accurate assessment Township departments, strictly cash rewards, prompted the departments own implementation at all levels. In working to advance, to truly grasp the Guide, seize the opportunity, finding a position and play to our strengths and take the initiative, ensure that the start of the new year tree, new performance. Grasp the Guide, is to dock in policy measures to seize the initiative. Accurate grasp of the Central Government, provinces and cities to speed up the development of new policies and new initiatives with a high degree of policy acumen to capture opportunities to accelerate development. Follow-up to promote the transformation and upgrading of the five great ideas offer a great chance. Five large development philosophy is the Party Central Committee with a view to promote economic transformation and upgrading, complete the building of a well-off society in major decisions and arrangements, is the development of a profound change. County-wide at all levels should conscientiously study and implement, implement the five ideas, green development, open development, on which to share advantages, and actively explore new path of innovative and coordinated development, changing the concept of leading the transformation of development mode of development, promote the development of quality improvement. Floor supply side structural reform implementation provides an effective strategy for improving the quality of development. Supply sidestructural reform is future full deepening reform of plays, to according to \policy to stability, and industry policy to associate, and micro policy to live, and reform policy to real, and social policy to backing\s, keen grasp Central, and provinces release out of new signal, combined County love actual accurate docking, full grasp \capacity, and to inventory, and to lever, and drop cost, and fill short Board\ntation, prompted County economic transformation upgrade, and continued upgrade. Poverty【解答】C

【分析】选择排序在最好、最坏、平均情况下的时间性能均为O(n2),归并排序在最好、最坏、平均情况下的时间性能均为O(nlog2n)。 ⑵ 下列序列中,( )是执行第一趟快速排序的结果。

A [da,ax,eb,de,bb] ff [ha,gc] B [cd,eb,ax,da] ff [ha,gc,bb] C [gc,ax,eb,cd,bb] ff [da,ha] D [ax,bb,cd,da] ff [eb,gc,ha] 【解答】A

【分析】此题需要按字典序比较,前半区间中的所有元素都应小于ff,后半区间中的所有元素都应大于ff。

⑶ 对初始状态为递增有序的序列进行排序,最省时间的是( ),最费时间的是()。已知待排序序列中每个元素距其最终位置不远,则采用( )方法最节省时间。 A 堆排序 B插入排序 C快速排序 D 直接选择排序 【解答】B,C,B

【分析】待排序序列中每个元素距其最终位置不远意味着该序列基本有序。

⑸ 当待排序序列基本有序或个数较小的情况下,最佳的内部排序方法是( ),就平均时间而言,( )最佳。

A 直接插入排序 B 起泡排序 C简单选择排序 D快速排序 【解答】A,D

⑼ 快速排序在( )情况下最不利于发挥其长处。 A 待排序的数据量太大 B 待排序的数据中含有多个相同值 C 待排序的数据已基本有序 D 待排序的数据数量为奇数 【解答】C

【分析】快速排序等改进的排序方法均适用于待排序数据量较大的情况,各种排序方法对待排序的数据中是否含有多个相同值,待排序的数据数量为奇数或偶数都没有影响。

these preous and worth cherishing. Second, scientific research situation, grasp the opportunities and challenges of transformation and upgrading of full completion of the \n-Five\s, start is crucial. Focused grand blueprint, must to history of thinking views trend, put associate times forward of pulse, stepped on associate economic law of drums, find associate transformation upgrade of path, in grasp macro trend in the advance science development; to strategy of vision conspiracy to global, always tight buckle national macro policy oriented, accurate grasp County love actual, based overall caught opportunities, and PCT thought, ensure County economic social development always along right track continued forward; to precision of measures seeking breakthrough, tightly pegged focus task and bottleneck restricted, Science and identify practical and effective measures, advance breakthrough, ensuring all tasks carry out to the letter; based on scientific assessment and strict implementation, persist in combining routine supervision and centralized supervision, accurate assessment Township departments, strictly cash rewards, prompted the departments own implementation at all levels. In working to advance, to truly grasp the Guide, seize the opportunity, finding a position and play to our strengths and take the initiative, ensure that the start of the new year tree, new performance. Grasp the Guide, is to dock in policy measures to seize the initiative. Accurate grasp of the Central Government, provinces and cities to speed up the development of new policies and new initiatives with a high degree of policy acumen to capture opportunities to accelerate development. Follow-up to promote the transformation and upgrading of the five great ideas offer a great chance. Five large development philosophy is the Party Central Committee with a view to promote economic transformation and upgrading, complete the building of a well-off society in major decisions and arrangements, is the development of a profound change. County-wide at all levels should conscientiously study and implement, implement the five ideas, green development, open development, on which to share advantages, and actively explore new path of innovative and coordinated development, changing the concept of leading the transformation of development mode of development, promote the development of quality improvement. Floor supply side structural reform implementation provides an effective strategy for improving the quality of development. Supply sidestructural reform is future full deepening reform of plays, to according to \policy to stability, and industry policy to associate, and micro policy to live, and reform policy to real, and social policy to backing\s, keen grasp Central, and provinces release out of new signal, combined County love actual accurate docking, full grasp \capacity, and to inventory, and to lever, and drop cost, and fill short Board\ntation, prompted County economic transformation upgrade, and continued upgrade. Poverty⑽ ( )方法是从未排序序列中挑选元素,并将其放入已排序序列的一端。 A 归并排序 B 插入排序 C 快速排序 D 选择排序 【解答】D 3. 判断题

⑴ 如果某种排序算法是不稳定的,则该排序方法没有实际应用价值。

【解答】错。一种排序算法适合于某种特定的数据环境,有时对排序的稳定性没有要求。 ⑵ 当待排序的元素很大时,为了交换元素的位置,移动元素要占用较多的时间,这是影响时间复杂性的主要因素。

【解答】对。此时着重考虑元素的移动次数。

⑶ 对n个记录的集合进行快速排序,所需要的附加空间是Ο(n)。 【解答】错。最坏情况下是Ο(n)。 排序----习题解析2 一、选择题

1、以下序列不是堆的是 D 。

A、(100,85,98,77,80,60,82,40,20,10,66) B、(100,98,85,82,80,77,66,60,40,20,10) C、(10,20,40,60,66,77,80,82,85,98,100) D、(100,85,40,77,80,60,66,98,82,10,20)

2、在文件“局部有序”或文件长度较小的情况下,最佳内部排序方法是 A 。 A、直接插入排序 B、冒泡排序 C、简单选择排序 D、归并排序

3、在下列算法中, C 算法可能出现下列情况;在最后一趟开始之前,所有的元素都不在其最终的位置上。

A、堆排序 B、冒泡排序

these preous and worth cherishing. Second, scientific research situation, grasp the opportunities and challenges of transformation and upgrading of full completion of the \n-Five\s, start is crucial. Focused grand blueprint, must to history of thinking views trend, put associate times forward of pulse, stepped on associate economic law of drums, find associate transformation upgrade of path, in grasp macro trend in the advance science development; to strategy of vision conspiracy to global, always tight buckle national macro policy oriented, accurate grasp County love actual, based overall caught opportunities, and PCT thought, ensure County economic social development always along right track continued forward; to precision of measures seeking breakthrough, tightly pegged focus task and bottleneck restricted, Science and identify practical and effective measures, advance breakthrough, ensuring all tasks carry out to the letter; based on scientific assessment and strict implementation, persist in combining routine supervision and centralized supervision, accurate assessment Township departments, strictly cash rewards, prompted the departments own implementation at all levels. In working to advance, to truly grasp the Guide, seize the opportunity, finding a position and play to our strengths and take the initiative, ensure that the start of the new year tree, new performance. Grasp the Guide, is to dock in policy measures to seize the initiative. Accurate grasp of the Central Government, provinces and cities to speed up the development of new policies and new initiatives with a high degree of policy acumen to capture opportunities to accelerate development. Follow-up to promote the transformation and upgrading of the five great ideas offer a great chance. Five large development philosophy is the Party Central Committee with a view to promote economic transformation and upgrading, complete the building of a well-off society in major decisions and arrangements, is the development of a profound change. County-wide at all levels should conscientiously study and implement, implement the five ideas, green development, open development, on which to share advantages, and actively explore new path of innovative and coordinated development, changing the concept of leading the transformation of development mode of development, promote the development of quality improvement. Floor supply side structural reform implementation provides an effective strategy for improving the quality of development. Supply sidestructural reform is future full deepening reform of plays, to according to \policy to stability, and industry policy to associate, and micro policy to live, and reform policy to real, and social policy to backing\s, keen grasp Central, and provinces release out of new signal, combined County love actual accurate docking, full grasp \capacity, and to inventory, and to lever, and drop cost, and fill short Board\ntation, prompted County economic transformation upgrade, and continued upgrade. PovertyC、插入排序 D、快速排序

4、从未排序的序列中依次取出一个元素与已排序序列中的元素依次进行比较,然后将其放在排序序列的合适位置,该排序方法称为 A 排序法。 A、插入 B、选择 C、希尔 D、二路归并

5、排序趟数与序列原始状态有关的排序方法是 D或C 排序法。 A、插入 B、选择 C、冒泡 D、快速

6、下面给出的四种排序方法中, D 排序是不稳定排序法。 A、插入 B、冒泡 C、二路归并 D、堆

7、快速排序在最坏情况下时间复杂度是O(n2),比 A 的性能差。 A、堆排序 B、起泡排序 C、选择排序

8、若需在O(nlog2n)的时间内完成对数组的排序,且要求排序是稳定的,则可选择的排序方法是 C 。

A、快速排序 B、堆排序 C、归并[排序 D、直接插入排序

9、就排序算法所用的辅助空间而言,堆排序、快速排序、归并排序的关系是 A 。 A、堆排序<快速排序<归并排序 B、堆排序<归并排序<快速排序 C、堆排序>归并排序>快速排序 D、堆排序>快速排序>归并排序 E、以上答案都不对

10、下面排序方法中,关键字比较次数与记录的初始排列无关的是 D 。 A、希尔排序 B、冒泡排序 C、直接插入排序 D、直接选择排序

11、对记录的关键字集合key={50,26,38,80,70,90,8,30,40,20}进行排序,各趟排序结束时的结果为:

50 26 38 80 70 90 8 30 40 20 50 8 30 40 20 90 26 38 80 70 26 8 30 40 20 80 50 38 90 70

联系合同范文客服:xxxxx#qq.com(#替换为@)