问题 单项选择题

下列排序方法中,最坏情况下比较次数最少的是 ______。

A.冒泡排序

B.简单选择排序

C.直接插入排序

D.堆排序

答案

参考答案:D

解析:[知识点] 排序技术[评析] 1) 冒泡排序法:是一种最简单的交换类排序法,它是通过相邻数据元素的交换逐步将线性表变成有序。假设线性表的长度为n,则在最坏情况下,冒泡排序需要经过n/2遍的从前往后的扫描和n/2遍的从后往前的扫描,需要比较的次数为n(n-1)/2次。2)简单插入排序法:在简单插入排序法中,每一次比较后最多移掉一个逆序,因此,这种排序方法的效率与冒泡排序法相同。在最坏情况下,简单插入排序需要。(n-1)/2次比较。3)简单选择排序法:对于长度为n的序列,选择排序需要扫描n-1遍,每一遍扫描均从剩下的子表中选出最小的元素,然后将该最小的元素与子表中的第一个元素进行交换,简单选择排序法在最坏情况下需要比较n(n-1)/2次。4)堆排序法:堆排序的方法为:①首先将一个无序序列建成堆。②然后将堆顶元素(序列中的最大项)与堆中最后一个元素交换(最大项应该在序列的最后)。在最坏情况下,堆排序需要比较的次数为O(nlog2(下标)n)。假设线性表的长度为16,那么冒泡排序、直接插入排序、简单选择排序都需要比较120次,而堆排序需要比较64次。

单项选择题

The effect of the baby boom on the schools helped to make possible a shift in thinking about the role of public education in the 1920’s. In the 1920’s, but especially (1) the Depression of the 1930’s, the United States experienced a (2) birth rate. Then with the prosperity (3) on by the Second World War and the economic boom that followed it, young people married and (4) households earlier and began to (5) larger families than had their (6) during the Depression. Birth rates rose to 102 per thousand in 1946, 106.2 in 1950, and 118 in 1955. (7) economics was probably the most important (8) , it is not the only explanation for the baby boom. The increased value placed (9) the idea of the family also helps to (10) this rise in birth rates. The baby boomers began streaming (11) the first grade by the mid-1940’s and became a (12) by 1950. The public school system suddenly found itself (13) The wartime economy meant that few new schools were buih between 1940 and 1945. (14) , large numbers of teachers left their profession during that period for better-paying jobs elsewhere.

(15) , in the 1950’s, the baby boom hit an antiquated and inadequate school system. Consequently, the custodial rhetoric of the 1930’s no longer made (16) ; keeping youths ages sixteen and older out of the labor market by keeping them in school could no longer be a high (17) for an institution unable to find space and staff to teach younger children. With the baby boom, the focus of educators (18) turned toward the lower grades and back to basic academic skills and (19) . The system no longer had much (20) in offering nontraditional, new, and extra services to older youths.

16()

A.sense

B.meaning

C.sensible

D.meaningful

问答题 论述题