问题 单项选择题

设有一个已按各元素的值排好序的顺序表(长度大于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,则说明待查找的节点只可能在右子表 K[mid+1]到R[n-1]中,我们只要在右子表中继续进行折半查找。这样,经过一次关键字比较就缩小一半的查找空间。对顺序查找而言,如果查找失败,比较次数为n次;对二分查找而言,如果查找失败,比较次数为log2(n+1)次。

单项选择题 A1/A2型题
单项选择题

Euthanasia has been a topic of controversy in Europe since at least 1936. On an average of six times a day, a doctor in Holland practices "active" euthanasia: (1) administering a lethal drug to a (2) ill patient who has asked to be relieved (3) suffering. Twenty times a day, life prolonging treatment is withheld or withdrawn (4) there is no hope that it can (5) an ultimate cure. "Active" euthanasia remains a crime on the Dutch statute books, punishable (6) 12 years in prison. But a series of court cases over the past 15 years has made it clear that a competent physician who (7) it out will not be prosecuted.

Euthanasia, often called "mercy killing", is a crime everywhere in Western Europe. (8) more and more doctors and nurses in Britain, Germany, Holland and elsewhere readily (9) to practicing it, most often in the "passive" form of withholding or withdrawing (10) The long simmering euthanasia issue has lately (11) into a sometimes fierce public debate, (12) both sides claiming the mantle of ultimate righteousness. Those (13) to the practice see themselves (14) sacred principles of respect for life, (15) those in favor raise the banner of humane treatment. After years (16) the defensive, the advocates now seem to be (17) ground. Recent polls in Britain show that 72 percent of British (18) favor euthanasia in some circumstances. An astonishing 76 percent of (19) to a poll taken late last year in France said they would like the law changed to (20) mercy killings. Obviously, pressure groups favoring euthanasia and "assisted suicide" have grown steadily in Europe over the years.

12()

A.due to

B. at

C. for

D. with