《算法导论》第四章-第5节_练习(参考答案)
来源:互联网 发布:淘宝在哪开店 编辑:程序博客网 时间:2024/04/30 14:42
算法导论(第三版)参考答案:练习4.5-1,练习4.5-2,练习4.5-3,练习4.5-4,练习4.5-5
Exercise 4.5-1
Use the master method to give tight asymptotic bounds for the following recurrences:
T(n)=2T(n/4)+1 T(n)=2T(n/4)+n√ T(n)=2T(n/4)+n T(n)=2T(n/4)+n2
a=2,b=4,f(n)=1.log42>0 ,满足情况一;解为T(n)=Θ(nlog42)=Θ(n√) a=2,b=4,f(n)=n√.log42=12 ,满足情况二;解为T(n)=Θ(nlog42lgn)=Θ(n√lgn) a=2,b=4,f(n)=n.log42<1,2f(n4)≤cf(n)(c=12) ,满足情况三;解为T(n)=Θ(n) a=2,b=4,f(n)=1.log42<2,2f(n4)≤cf(n)(c=18) ,满足情况三;解为T(n)=Θ(n2)
Exercise 4.5-2
Professor Caesar wishes to develop a matrix-multiplication algorithm that is asymptotically faster than Strassen’s algorithm. His algorithm will use the divide-and-conquer method, dividing each matrix into pieces of size
n/4×n/4 , and the divide and combine steps together will takeΘ(n2) time. He needs to determine how many subproblems his algorithm has to create in order to beat Strassen’s algorithm. If his algorithm creates asubproblems, then the recurrence for the running time T(n) becomesT(n)=aT(n/4)+Θ(n2) . What is the largest integer value of a for which Professor Caesar’s algorithm would be asymptotically faster than Strassen’s algorithm?
Strassen递归式:
情况三可以排除(矩阵乘法
Exercise 4.5-3
Use the master method to show that the solution to the binary-search recurrence
T(n)=T(n/2)+Θ(1) isT(n)=Θ(lgn) . (See exercise 2.3-5 for a description of binary search).
Exercise 4.5-4
Can the master method be applied to the recurrence
T(n)=4T(n/2)+n2lgn ? Why or why not? Give an asymptotic upper bound for this recurrence.
递归式:
Exercise 4.5-5
⋆ Consider the regularity condition
af(n/b)≥cf(n) for some constantc<1 , which is part of case 3 of the master theorem. Give an example of constantsa≥1 andb>1 and a functionf(n) that satisfies all the conditions in case 3 of the master theorem, except the regularity condition.
假设存在递归式:
当
- 《算法导论》第四章-第5节_练习(参考答案)
- 《算法导论》第四章-第1节_练习(参考答案)
- 《算法导论》第四章-第2节_练习(参考答案)
- 《算法导论》第四章-第3节_练习(参考答案)
- 《算法导论》第四章-第4节_练习(参考答案)
- 《算法导论》第四章-第6节_练习(参考答案)
- 《算法导论》第一章-第1节_练习(参考答案)
- 《算法导论》第一章-第2节_练习(参考答案)
- 《算法导论》第二章-第1节_练习(参考答案)
- 《算法导论》第二章-第2节_练习(参考答案)
- 《算法导论》第二章-第3节_练习(参考答案)
- 《算法导论》第三章-第1节_练习(参考答案)
- 《算法导论》第三章-第2节_练习(参考答案)
- 《算法导论》第五章-第1节_练习(参考答案)
- 《算法导论》第五章-第2节_练习(参考答案)
- 《算法导论》第五章-第3节_练习(参考答案)
- 《算法导论》第五章-第4节_练习(参考答案)
- 《算法导论》第四章-思考题(参考答案)
- 如何解决合法帧
- ffmpeg是配ios
- v$dataguard_stats 的apply finish time 为空
- 获取地址栏传过来的值,赋值给页面并模拟点击start
- Android studio导入Eclipse项目,以及一些错误的解决
- 《算法导论》第四章-第5节_练习(参考答案)
- 一分钟了解"matlab在命令窗口显示句子命令disp"
- 汉诺塔
- 【HAOI2012】高速公路 线段树区间维护
- Activiti扩展组织结构
- Word Ladder
- Android Studio Ndk 编程
- origin 函数
- 基于OpenStack和Kubernetes构建组合云平台——网络集成方案综述