问题 单项选择题

对于长度为n的线性表,在最坏的情况下,下列各排序法所对应的比较次数中正确的是______。

A) 冒泡排序为n/2
B) 冒泡排序为n
C) 快速排序为n
D) 快速排序为n(n-1)/2

答案

参考答案:D

解析: 存最坏情况下,快速排序退化为冒泡排序,冒泡排序法的基本过程参见本题的理论链接。冒泡排序的每个元素都要与它前面的元素相比较,因此比较次数为(n-1)+(n-2)+…+1=n(n-1)/2。

阅读理解

阅读理解。

      When I was 12 years old, I was in Grade 1 at middle school. I thought I could be the first in the

class. But the result of the first exam told me that I was wrong. Although I was good at math and

English, my history was poor. I thought history was boring.

     Then, my scores of history became worse and worse. I began to be afraid of it.

     At the end of the third semester, my history was still bad. I didn't understand why. At that time,

my sister helped me analyze (分析) the reason. She told me, "You must do your best to study history,

or you will fall behind." Then I thought a lot. The second day, I took out the history book. I read loudly,

and tried my best to remember history knowledge. I did it every day during that summer holiday. The

fourth semester would be over. I was very worried about my history. But I found that I scored 95 in

the history test. I was very happy and wanted to tell everyone, "Nothing is difficult if you put your heart

into it."

1. When the writer was 12, he was a student of             At middle school. [ ]

A. Grade 1   

B. Grade 2   

C. Class 1  

D. Class2

2. The writer's best subjects were            .[ ]

A. math and history     

B. math and English

C. history and English    

D. Chinese and math

3. The writer thought history            . [ ]

A. interesting    

B. useful   

C. boring   

D. difficult

4. The writer made good use of             to work hard at history. [ ]

A. every Sunday     

B. some weekends

C. every night       

D. that summer holiday

5. The best title (标题) of this passage is:            .[ ]

A. You should study   

B. How to study history?

C. Nothing is difficult if you put your heart into it.

D. A sister helped her brother.

单项选择题