问题 单项选择题

对n个元素的有序表A[1…n]进行二分(折半)查找(除2取商时向下取整),查找元素A[i](1≤i≤n)时,最多与A中的______个元素进行比较。

A.n

B.log2n-1

C.n/2

D.log2n+1

答案

参考答案:D

解析:
本题考查数据结构基础知识。
二分查找是一种效率较高的查找方法,在10个元素构成的有序表中进行二分查找的过程可用二分查找判定树表示,如下图所示:

其中,结点中的数字表示元素在表中的序号。以结点10为例,它所在的位置说明若要查找表中的第10个元素,则依次与第5个、第8个、第9个和第10个元素进行了比较。若有序表中有n个元素,则对其进行二分查找的判定树的高度为log2n+1(与具有n个结点的完全二叉树高度一样),因此,查找过程中最多与log2n+1个元素进行比较。

阅读理解

阅读理解。

     Acting is such an over-crowded profession that the only advice that should be given to a

young person thinking of going on the stage is "Don't!". But it is useless to try to discourage

someone who feels that he must act, though the chances of his becoming famous are slim. The

normal way to begin is too to a drama school. Usually only students who show promise and

talent are accepted, and the course lasts two years.

Then the young actor or actress takes up work with a repertory company, usually as an assistant

stage manager. This means doing everything that there is to do in the theatre: painting scenery,

looking after the furniture, taking care of the costumes, and even acting in very small parts. It is

very hard work indeed. The hours are long and the salary is tiny. But young actors with the stage

in their blood are happy, waiting for the chances of working with a better company, or perhaps

in films or television.

     Of course, some people have unusual chances which lead to fame and success without this

long and dull training. Connie Pratt, for example, was just an ordinary girl working in a bicycle

factory. A film producer happened to catch sight of her one morning waiting at a bus stop, as he

drove past in his big car. He told the driver to stop, and he got out to speak to the girl. He asked

her if she would like to go to the film studio

to do a test, and at first she thought he was joking. Then she got angry and said she would call the

police. It took the producer twenty minutes to tell Connie that he was serious. Then an appointment

was made for her to go to the studio the next day. The test was successful. They gave her some

necessary lessons and within a few weeks she was playing the leading part opposite one of the

most famous actors of the day. Of

course, she was given a more dramatic name, which is now world-famous. But chances like this

happen once in a blue moon!

1. According to the passage, the main reason why young people should be discouraged from becoming

actors is ________.

A. actors are very unusual people

B. the course at the drama school lasts two years

C. acting is really a hard job

D. there are already too many actors

2. According to the context, the sentence "But young actors with the stage in their blood are happy" at

    the end of the first paragraph means ________.

A. they don't care if their job is hard

B. they like the stage naturally

C. they are born happy

D. they are easily satisfied

3. Connie Pratt soon became a famous actress after ________.

A. learning some lessons about the art of speaking

B. playing her part in the "Blue Colored Moon"

C. successfully matching the most famous actors

D. acting a leading part with a most famous actor at that time

4. The phrase "once in a blue moon" in the last line of the passage means ________.

A. all at once                    

B. once for a long time

C. once in a while                

D. once and for all

单项选择题