问题 单项选择题

对一个长度为10的排好序的表用二分法检索,若检索不成功,至少需要比较的次数是 ________。

A.6

B.5

C.4

D.3

答案

参考答案:D

解析:
[评析] 二分法检索要求线性表结点按关键码值排好序且以顺序方式存储。在查找时,首先与表的中间位置上结点的关键码值比较,若相等则检索成功;否则根据比较结果确定下一步在表的前半部或后半部中继续进行。对于有n个元素的线性表,其最多要比较的次数为大于log2n的最小整数,最少的检索次数为1。

选择题
单项选择题

"The first and best of victories is for a man to conquer himself; to be conquered by himself is, of all things, the most shameful", says Plato. Self-control is at the root of all the advantages. Let a man give in to his impulses and feelings, and from that moment he gives up his moral freedom.

What is the correct interpretation of "Whom the gods would destroy they first make mad"
A. If the gods want to kill you, they make you crazy first.
B. If you always lose your temper, you will soon be finished.
C. If you cannot control yourself, you will become crazy.
D. If you are mad, you will be punished by the gods.

A single angry word has lost many a friend. When Socrates found in himself any temper or anger, he would check it by speaking low in order to control himself. If you are conscious of being angry, keep your mouth shut so that you can hold back rising anger. Many a person has dropped dead in great anger. Fits of anger bring fits of disease. "Whom the gods would destroy they first make mad. " "Keep cool", says George Herbert, "for fierceness makes error a fault. "
To be angry with a weak man is to prove that you are not p yourself. "Anger, " says Pythagoras, "brings with folly and ends with regret. " You must measure the strength of a man by the power of the feelings he conquers, not by the power of those which conquer him.
Self-control is man’s last greatest victory.
If a man lacks self-control he seems to lack everything. Without it he can have no patience, no power to govern himself; he can have no self-confidence, for he will always be controlled by his pest feeling. If he lacks self-control, the very backbone and nerve of character are lacking also.