题目
单项选择题
Recr_12 Identify the recurrence relation for the function shown below.
选项
A.T ( n ) = { Θ ( 1 ) if n < 2 3 T ( n 4 ) + Θ ( l o g n ) otherwise {"version":"1.1","math":"T(n) = \begin{cases} \Theta(1) & \text{if } n < 2 \\ 3T\left(\frac{n}{4}\right) + \Theta(logn) & \text{otherwise} \end{cases} "}
B.T ( n ) = { Θ ( 1 ) if n < 2 3 T ( n 4 ) + Θ ( n 2 l o g n ) otherwise {"version":"1.1","math":"T(n) = \begin{cases} \Theta(1) & \text{if } n < 2 \\ 3T\left(\frac{n}{4}\right) + \Theta(n^2logn) & \text{otherwise} \end{cases} "}
C.T ( n ) = { Θ ( 1 ) if n < 2 3 T ( n 4 ) + Θ ( n 2 ) otherwise {"version":"1.1","math":"T(n) = \begin{cases} \Theta(1) & \text{if } n < 2 \\ 3T\left(\frac{n}{4}\right) + \Theta(n^2) & \text{otherwise} \end{cases} "}
D.T ( n ) = { Θ ( 1 ) if n < 2 3 T ( n 4 ) + Θ ( n ) otherwise {"version":"1.1","math":"T(n) = \begin{cases} \Theta(1) & \text{if } n < 2 \\ 3T\left(\frac{n}{4}\right) + \Theta(n) & \text{otherwise} \end{cases} "}
E.T ( n ) = { Θ ( 1 ) if n < 2 3 T ( n 4 ) + Θ ( n l o g n ) otherwise {"version":"1.1","math":"T(n) = \begin{cases} \Theta(1) & \text{if } n < 2 \\ 3T\left(\frac{n}{4}\right) + \Theta(nlogn) & \text{otherwise} \end{cases} "}
查看解析
标准答案
Please login to view
思路分析
Question restatement: Identify the recurrence relation for the function shown below.
Answer options to evaluate:
1) T(n) = { Θ(1) if n < 2; 3 T(n/4) + Θ(log n) otherwise }
2) T(n) = { Θ(1) if n < 2; 3 T(n/4) + Θ(n^2 log n) otherwise }
3) T(n) = { Θ(1) if n < 2; 3 T(n/4) + Θ(n^2) otherwise }
4) T(n) = { Θ(1) if n < 2; 3 T(n/4) + Θ(n) otherwise }
5) T(n) = { Θ(1) if n < 2; 3 T(n/4) + Θ(n log n) otherwise }
6) T(n) = { Θ(1) if n < 2; 3 T(n/4) + Θ(n log n) otherwise }
Option 1 analysis:
- This option uses Θ(log n) as the non-recursive combination cost. The dominant work outside the recursive calls would be proportional to log n. Unless there is a hidden n factor in the combine step, this is unlikely to reflect a typical divide-by-4 recurrence where the combine cost scales with n or a higher order term. Therefore, this option seems to understate the work unless the problem explicitly def......Login to view full explanation登录即可查看完整答案
我们收录了全球超50000道考试原题与详细解析,现在登录,立即获得答案。
类似问题
Recr_4 Identify the recurrence relation for the binary_search function described below, which recursively searches for a value in a sorted list.
Recr_Q_6 What is the recurrence relation for the quick_sort function given below in the average case scenario as described below?
Ms_7 Consider the recurrence relation for recursive algorithm \(T(n)\) given by: T(n) = \begin{cases} \Theta(1) & \text{if } n < 2 \\9T\left(\frac{n}{3}\right) + \Theta(n) & \text{otherwise}\end{cases} What is the run time complexity of this algorithm? The Master Theorem is provided below. Use it as you see fit:
zyBooks_17_1 Suppose a recursive function's runtime is T(n−1)+Θ(n){"version":"1.1","math":"T(n-1) + \Theta(n)"} How many levels will the recursion tree have?
更多留学生实用工具
希望你的学习变得更简单
加入我们,立即解锁 海量真题 与 独家解析,让复习快人一步!