【PTA】【数据结构与算法】分治法

判断题

1.任何一个递归过程都可以转换成非递归过程。
TF
2.For the recurrence equation T(N)=aT(N/b)+f(N), if af(N/b)=Kf(N) for some constant K>1, then T(N)=Θ(f(N)).
TF
3.对于递推方程 T(N)=aT(N/b)+f(N),若存在常数 K>1 使得 af(N/b)=Kf(N),则有 T(N)=Θ(f(N))。
TF
4.If devide-and-conquer strategy is used to find the closest pair of points in a plane, unless the points are sorted not only by their x coordinates but also by their y coordinates, it would be impossible to solve it in a time of O(NlogN), where N is the number of points.
TF
5.用向量和单链表表示的有序表均可使用折半查找方法来提高查找速度。
TF

选择题

1.When solving a problem with input size N by divide and conquer, if at each stage the problem is divided into 8 sub-problems of equal size N/3, and the conquer step takes O(N2​​logN) to form the solution from the sub-solutions, then the overall time complexity is __.
选项
AO(N2logN)
BO(N​2log​2N)
CO(N​3log​N)
DO(Nlog8/log3)
2.To solve a problem with input size N by divide and conquer algorithm, among the following methods, __ is the worst.
选项
Adivide into 2 sub-problems of equal complexity N/3 and conquer in O(N)
Bdivide into 2 sub-problems of equal complexity N/3 and conquer in O(NlogN)
Cdivide into 3 sub-problems of equal complexity N/2 and conquer in O(N)
Ddivide into 3 sub-problems of equal complexity N/3 and conquer in O(NlogN)
3.对N个元素的表做顺序查找时,若查找每个元素的概率相同,则平均查找长度为( )
选项
A(N+1)/2
BN/2
CN
D(N+1)*N /2
4.3-way-mergesort : Suppose instead of dividing in two halves at each step of the mergesort, we divide into three one thirds, sort each part, and finally combine all of them using a three-way-merge. What is the overall time complexity of this algorithm ?
选项
AO(n(log2n))
BO(n2logn)
CO(nlogn)
DO(n)
5.设有序表的关键字序列为{1,4,6,10,18,35,42,53,67,71,78,84,92,99},当用二分查找法查找健值为84的结点时,经( )次比较后查找成功。
选项
A2
B3
C4
D12
6.When solving a problem with input size N by divide and conquer, if at each step, the problem is divided into 9 sub-problems and each size of these sub-problems is N/3, and they are conquered in O(N2​​ logN). Which one of the following is the closest to the overall time complexity?
选项
AO(N2 log2​​ N)
BO(N2 logN)
CO(N2)
DO(N3logN)
7.采用顺序查找法查找长度为n的线性表时,查找不成功的平均查找长度为( )。
选项
An
Bn/2
C(n+1)/2
D(n-1)/2
8.When solving a problem with input size N by divide and conquer, if at each step, the problem is divided into 16 sub-problems and each size of these sub-problems is N/4, and they are conquered in O(N2logN). Which one of the following is the closest to the overall time complexity?
选项
AO(N2​​logN)
B O(N2​​log2N)
CO(N2​​ )
DO(N3​​ logN)
9.已知一个长度为11的顺序表L,其元素按关键字有序排列。若采用二分查找法查找,查找成功时,最坏的比较次数是。
选项
A3
B 4
C5
D6
10.在数据元素有序、元素个数较多而且固定不变的情况下宜采用的查找方法是( )。
选项
A折半查找
B分块查找
C二叉排序树查找
D顺序查找
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值