皮皮学,免费搜题
登录
搜题
【单选题】
列三个算法是关于 “ 大规模数据集合中查找有无某些元素 ” 问题的算法:针对一个 “ 学生 ” 数据表,如下示意,找出 “ 成绩 ” 为某一分数的所有学生。 【算法 A1 】 Start of algorithm A1 Step 1. 从数据表的第 1 条记录开始,直到其最后一条记录为止,读取每一条记录,做 Step 2 。 Step 2. 对每一条记录,判断成绩是否等于给定的分数:如果是,则输出;如果不是,则不输出。 End of algorithm A1 【算法 A2 】 Start of algorithm A2 Step 1. 从数据表的第 1 条记录开始,直到其最后一条记录为止,读取每一条记录,做 Step 2 和 Step 3 。 Step 2. 对每一条记录,判断成绩是否等于给定的分数:如果等于,则输出;如果不等于,则不输出。 Step 3. 判断该条记录的成绩是否小于给定的分数:如果不是,则继续;否则,退出循环,算法结束。 End of algorithm A2 【算法 A3 】 Start of algorithm A3 Step 1. 假设数据表的最大记录数是 n ,待查询区间的起始记录位置 Start 为 1 ,终止记录位置 Finish 为 n ; Step 2. 计算中间记录位置 I = (Start+Finish)/2 ,读取第 I 条记录。 Step 3. 判断第 I 条记录的成绩与给定查找分数: (3.1) 如果是小于关系,则调整 Finish = I-1 ;如果 Start >Finish 则结束,否则继续做 Step 2 ; (3.2) 如果是大于关系,则调整 Start = I+1 ;如果 Start>Finish 则结束,否则继续做 Step 2 ; (3.3) 如果是等于关系,则输出,继续读取 I 周围所有的成绩与给定查找条件相等的记录并输出,直到所有相等记录查询输出完毕则算法结束。 End of algorithm A3 针对上述三个算法,回答问题:关于三个算法的复杂性,下列说法正确的是 _____ 。
A.
算法 A1 的时间复杂性为 O(n) ,算法 A2 的时间复杂性为 O(n/2) ,算法 A3 的时间复杂性为 O(n/4)
B.
算法 A1 和 A2 的时间复杂性为 O(1) ,算法 A3 的时间复杂性为 O(n)
C.
算法 A1 、 A2 和 A3 的时间复杂性都为 O(n)
D.
算法 A1 和 A2 的时间复杂性为 O(n) ,算法 A3 的时间复杂性为
拍照语音搜题,微信中搜索"皮皮学"使用
参考答案:
参考解析:
知识点:
.
..
皮皮学刷刷变学霸
举一反三
【单选题】How many ethnic groups are in China?
A.
54
B.
55
C.
56
D.
57
【单选题】--- Can you tell me how many study groups there are in a class? --- Generally speaking, a class often ___ 8 study groups, each with 7 group members.
A.
is consisted of
B.
is made of
C.
made up of
D.
consists of
【单选题】习题1.4 下面关于计算机控制系统中的A/D字长说法正确的是:( )
A.
A/D 的字长对计算机控制系统没有影响;
B.
A/D 的字长对计算机控制系统有一些影响,但不会影响控制性能
C.
如果 A/D 的字长选择不合适有可能会使计算机控制系统产生极限环振荡
D.
如果采样周期满足要求, A/D 字长对系统没有影响
E.
A/D 字长可自由选择
【简答题】Complete the passage with the appropriate words or expressions in the box. Change the form when necessary. prefix="o" ns="urn:schemas-microsoft-com:office:office" ?xml:namespace> self-sufficient inqui...
【单选题】输液剂中不得含有
A.
抑菌剂
B.
乳化剂
C.
抗氧剂
D.
渗透压调节剂
【简答题】One day one of my self-proclaimed Month of Gratitude , my five-year-old son woke up “bored” at 5:15 a.m. , I spied a speeding ticket in my wife’s purse , and our water heater spluttered to its death a...
【单选题】How many groups of people using the scientific method are mentioned in the passage?
A.
Three.
B.
Two.
C.
One.
D.
Four.
【简答题】What would the most advanced , most forward-looking , most self-assured country in prefix="o" ns="urn:schemas-microsoft-com:office:office" ?xml:namespace> history do without its periodic cr of con...
【简答题】win7开启ICF后局域网内机器如何实现互访?
【单选题】How many ethnic groups in China?
A.
55
B.
56
C.
57
D.
53
相关题目: