问题 问答题

一个长度为L(L≥1)的升序序列S,处在第[L/2]个位置的数称为s的中位数。例如,若序列S1:(11,13,15,17,19),则S1的中位数是15。两个序列的中位数是含它们所有元素的升序序列的中位数。例如,若S2=(2,4,6,8,20),则S1和S2的中位数是11。现有两个等长升序序列A和B,试设计一个在时间和空间两方面都尽可能高效的算法,找出两个序列A和B的中位数。

要求:

(1)给出算法的基本设计思想。

(2)根据设计思想,采用C或C++或Java语言描述算法,关键之处给出注释。

(3)说明你所设计算法的时间复杂度和空间复杂度。

答案

参考答案:

阅读理解
阅读理解。
On October 25, Liu Xiang picked up a gold medal at the 11th Chinese
National Games. He is a first Chinese hurdler to win a gold medal three
times. "I, m feeling great, Liu said. “I started to take part in the National
Games at the age of 18. Now I, m 26. I hope I can run at the Games
again in four years. "
Zhang Lili, a Chinese language teacher in Jiamusi, Heilongjiang province,was run over by a school bus as she pushed two students out of the way. After news of the accident was reported online, micro blogs were filled
with concern (关注)and admiration (钦佩)for the teacher,with one netizen (网名)calling Zhang “ the most beautiful teacher in China”.
On November 16, an overloaded (超载)school bus ran into a coal truck
in Gansu province. The accident killed at least 21 People-including 19
preschoolers (学龄前^匕童)and hurt another 43, mostly children. The
nine-seated bus was overloaded with 64 people.
1. The three passages above are most probably taken from.
A. Newspapers
B. Novels
C. Diaries
D. Books
2. What does the underlined part mean?
A. 拾起
B. 恢复
C. 顺便学到
D. 摘取
3. What can be the best title for the second passage?
A. Two pushed-away students.      
B. The most beautiful teacher in China.
C. The most beautiful bride (新娘).
D. A Chinese language teacher.
4. How many preschoolers were killed in the accident?
A.64.  
B.21.
C.19.
D.43.
5. Which is Not mentioned in the passage?
A. Zhang Lili comes from Heilongjiang province.
B. Liu Xiang joined in the National Games when he was 18.
C. The school bus accident happened in Gansu province.
D. More yellow school buses will be seen on the road in China.
单项选择题