判断题
1.任何一个递归过程都可以转换成非递归过程。
T | F |
---|
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)).
T | F |
---|
3.对于递推方程 T(N)=aT(N/b)+f(N),若存在常数 K>1 使得 af(N/b)=Kf(N),则有 T(N)=Θ(f(N))。
T | F |
---|
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.
T | F |
---|
5.用向量和单链表表示的有序表均可使用折半查找方法来提高查找速度。
T | F |
---|
选择题
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(N2logN) to form the solution from the sub-solutions, then the overall time complexity is __.
选项 | |
---|---|
A | O(N2logN) |
B | O(N2log2N) |
C | O(N3logN) |
D | O(Nlog8/log3) |
2.To solve a problem with input size N by divide and conquer algorithm, among the following methods, __ is the worst.
选项 | |
---|---|
A | divide into 2 sub-problems of equal complexity N/3 and conquer in O(N) |
B | divide into 2 sub-problems of equal complexity N/3 and conquer in O(NlogN) |
C | divide into 3 sub-problems of equal complexity N/2 and conquer in O(N) |
D | divide into 3 sub-problems of equal complexity N/3 and conquer in O(NlogN) |
3.对N个元素的表做顺序查找时,若查找每个元素的概率相同,则平均查找长度为( )
选项 | |
---|---|
A | (N+1)/2 |
B | N/2 |
C | N |
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 ?
选项 | |
---|---|
A | O(n(log2n)) |
B | O(n2logn) |
C | O(nlogn) |
D | O(n) |
5.设有序表的关键字序列为{1,4,6,10,18,35,42,53,67,71,78,84,92,99},当用二分查找法查找健值为84的结点时,经( )次比较后查找成功。
选项 | |
---|---|
A | 2 |
B | 3 |
C | 4 |
D | 12 |
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?
选项 | |
---|---|
A | O(N2 log2 N) |
B | O(N2 logN) |
C | O(N2) |
D | O(N3logN) |
7.采用顺序查找法查找长度为n的线性表时,查找不成功的平均查找长度为( )。
选项 | |
---|---|
A | n |
B | n/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?
选项 | |
---|---|
A | O(N2logN) |
B | O(N2log2N) |
C | O(N2 ) |
D | O(N3 logN) |
9.已知一个长度为11的顺序表L,其元素按关键字有序排列。若采用二分查找法查找,查找成功时,最坏的比较次数是。
选项 | |
---|---|
A | 3 |
B | 4 |
C | 5 |
D | 6 |
10.在数据元素有序、元素个数较多而且固定不变的情况下宜采用的查找方法是( )。
选项 | |
---|---|
A | 折半查找 |
B | 分块查找 |
C | 二叉排序树查找 |
D | 顺序查找 |