问题 单项选择题

对长度为n的有序表进行二分(折半)查找时,无论查找指定的一个元素是否成功,最多只与表中的()个元素进行比较即可。

A.[log2n]-1 

B.[log2n]+1

C.n/2

D.n-1

答案

参考答案:B

解析:

本题考查基本算法中的查找运算。

对长度为,2的有序表进行二分(折半)查找时,其查找过程可用一棵二叉树描述(折半查找判定树),其高度与n个结点构成的完全二叉树的高度相同(即[*]),查找过程中从根结点最多比较到二叉树的最高层结点,因此参与比较的元素个数不超过[*]。

填空题

Many animals engage in play,but homo sapiens is the only animal (1) have invented sports.Since sports are an invention,a part of culture (2) than an aspect of nature,all definitions of sports are somewhat arbitrary. (3) sports are a human universal found in every known culture or a (4) unique to modern society depends upon one’s definition of sports.Men and (5) have always run,jumped,climbed,lifted,thrown, and wrestled,but they have (6) always performed these physical activities competitively. Although all literate societies seem to (7) contests of one sort or another in which men, and sometimes women, (8) in displays and tests of physical skill and prowess,sports may be (9) defined as physical contests performed for their own sake and not for (10) ulterior end.According to this strict definition,neither Neolithic hunters nor contestants (11) religious ceremonies such as the ancient Olympic Games were engaged in sports. (12) on the stipulation that sports must be performed for their own sake (13) the paradoxical elimination of many activities which are usually thought of as (14) ,such as exercises done for the sake of cardiovascular fitness,races run (15) satisfy a physical education requirement,ball games played to earn a paycheck. (16) definition also means abandonment of the traditional usage in which"sport,"derived (17) Middle English disporter,refers to any light hearted recreational activity.In the. (18) of some 18th- century aristocrats,a game of backgammon and the seduction of (19) milkmaid were both considered good sport,but this usage of the term (20) become archaic.

单项选择题