问题 单项选择题

设有一个已按各元素的值排好序的顺序表(长度大于2),现分别用顺序查找法和二分查找法查找与给定值k相等的元素,比较的次数分别是s和b,在查找不成功情况下s和b的关系是( )。

A.s=b

B.s>b

C.s<b

D.s>=b

答案

参考答案:B

解析:顺序查找的基本思想是:从表的一端开始,顺序扫描线性表,依次将扫描到的结点关键字和给定值K相比较,若当前扫描到的结点关键字与K相等,则查找成功;若扫描结束后,仍未找到关键字等于K的结点,则查找失败。二分查找是一种效率较高的查找方法,要求线性表是有序表。基本思想是:首先将待查的K值和有序表R [0]到R[n-1]的中间位置mid上的结点的关键字进行比较,若相等,则查找完成;否则,若R[mid].key>K,则说明待查找的结点只可能在左子表R[0]到R[mid-1]中,我们只要在左子表中继续进行折半查找,若R[mid].key<K,则说明待查找的结点只可能在右子表R[mid+1)到R[n-1]中,我们只要在右子表中继续进行折半查找。这样,经过一次关键字比较就缩小一半的查找空间。对顺序查找而言,如果查找失败,比较次数为n次;二分查找而言,如果查找失败,比较次数为log 2(n+1)次。

阅读理解
阅读理解。

         Leaves are nature's food factories. Plants take water from the ground through their roots. They take a gas
called carbon dioxide (CO2) from the air. Plants use sunlight to turn water and CO2 into glucose. Glucose is a
kind of sugar. Plants are glucose as food for energy to grow. The way plants turn water and CO2 into glucose
is called photosynthesis. That means "putting together with light". A chemical called chlorophyll helps make
photosynthesis happen. Chlorophyll is green. It gives plants their green colour.
         As summer ends and autumn comes, the days get shorter and shorter. This is how the trees "know" to
begin getting ready for winter.
         During winter, there is now enough light or water for photosynthesis. The trees will rest, and live on the
food they have stored during the summer. They begin to close their food-making factories. The green
chlorophyll disappears from the leaves. Then, we begin to see yellow and orange colours. A few of these colors
stay in the leaves all the time. We just can't see them in the summer, because they are covered up by the green
chlorophyll.        
          Red and purple colors we see in leaves are made mostly in the autumn. In some trees, like maples (枫树),
glucose is stored in the leaves after photosynthesis stops. Sunlight and the cool nights of autumn turn this
glucose into red. The brown color of trees like oaks (橡树) is made from wastes left in the leaves.
1. The word "chlorophyll" in the first paragraph means ____ in Chinese.
A. 叶绿素
B. 氧气
C. 胡萝卜素
D. 蛋白质
2. Where is carbon dioxide from?
A. Ground.
B. Roots.
C. Sunlight.
D. Air.
3. The way ______ is called photosynthesis.
A. plants get carbon dioxide from the air
B. plants take water from the ground
C. plants turn water and carbon dioxide into glucose
D. plants use glucose as food for energy to grow
4. Red and purple colors in leaves are made mostly in ______.
A. spring
B. autumn
C. summer
D. winter
5. ______ in the leaves changes into red color in autumn.
A. Sunlight
B. Water
C. Glucose
D. Chlorophyll
单项选择题