算法导论第三版 第3章习题答案
2020/10/28:初稿,参考https://ita.skanev.com/,修订参考文献的部分错误
2020/10/30:修订第二节第4题的证明错误(参考https://blog.csdn.net/qq_36414798/article/details/81028403)
3 Growth of Functions
3.1 Asymptotic notation
1.Let f(n) + g(n) be asymptotically nonnegative functions. Using the basic definition of Θ-notation, prove that max(f(n),g(n))=Θ(f(n)+g(n)).
From asymptotically nonnegative, we can assume that:
Let , some obvious things for :
From the last two inequalities, we get:
Which is the definition of with
2.Show that for any real constants a and b, where b>0,
The most significant term is and this is obviously polynomially tightly bound.
3.Explain why the statement, "The running time of algorithm A is at least is meaningless.
The O-notation provides an upper bound. "At least" implies a lower bound.
4.Is ? Is
Yes, because if we choose 2 for both constants in the O-notation definition, we get an equality.
No, because
5.Prove Theorem 3.1
The theorem states:
For any two functions f(n) and g(n), we have f(n)=Θ(g(n)) if and only if f(n)=O(g(n)) and f(n)=Ω(g(n))
6.Prove that the running time of an algorithm is Θ(g(n)) if and only if its worst-case running time is O(g(n)) and its best-case running time is Ω(g(n)).
7.Prove o(g(n))∩ω(g(n)) is the empty set.
8.We can extend our notation to the case of two parameters n and m that can go to infinity independently at different rates. For a given function g(n,m) we denote O(g(n,m)) the set of functions:
Give corresponding definitions for Ω(g(n,m)) and Θ(g(n,m)).
3.2 Standard notations and common functions
1.Show that if f(n) and g(n) are monotonically increasing functions, then so are the functions f(n)+g(n) and f(g(n)), and if f(n) and g(n) are in addition nonnegative, then f(n)⋅g(n) is monotonically increasing.
2.Prove equation (3.16)
3.Prove equation (3.19). Also prove that n!=ω() and n!=o().
4.Is the function ⌈lgn⌉! polynomially bounded? Is the function ⌈lglgn⌉! polynomially bounded?
⌈lgn⌉! is not polynomially bounded, but ⌈lglgn!⌉ is.
If we take the definition of polynomially bound:
and take the logarithm of each side, we get:
Thus, a function is polynomially bound if
In the following proofs, we will make use of the following two facts:
lg(n!) = Θ(nlgn) (by equation (3.19))
⌈lgn⌉ = Θ(lgn), because
· ⌈lgn⌉ ≥ lgn
· ⌈lgn⌉ ≤ lgn + 1 ≤ 2lgn, for all n ≥ 2
lg(⌈lgn⌉!) = Θ(⌈lgn⌉lg⌈lgn⌉) = Θ(lgn lg lgn) = ω(lgn).Therefore, lg(⌈lgn⌉!) ≠ Ο(lgn), and so ⌈lgn⌉! is not polynomially bounded.
lg(⌈lglgn⌉!) = Θ(⌈lglgn⌉lg⌈lglgn⌉) = Θ(lglgn lg lglgn) = = = ο(lgn) .
The last step above follows from the property that any polylogarithmic function grows more slowly than any positive polynomial function, i.e., that for constants a, b > 0, we have = . Substitute lgn for n, 2 for b, and 1 for a, giving.
Therefore, lg(⌈lglgn⌉!) = Ο(lgn), and so ⌈lglgn⌉! is polynomially bounded.
5. Which is asymptotically larger:
The second, because:
6.Show that the golden ratio ϕ and its conjugate both satisfy the equation .
7.Proove by induction that the ith Fibonacci number satisfies the equality
Base:
Step:
8.Show that implies .
Problem
3.1 Asymptotic behavior of polynomials
3.2 Asymptotic behavior of polynomials
Indicate for each pair of expressions (A,B) in the table below, whether A is O, o, Ω, ω, or Θ of B. Assume that k≥1, ϵ>0, and c>1 are constants. Your answer should be in the form of the table with "yes" or "no" written in each box.
Note:
3.3 Ordering by asymptotic growth rates.
a.Rank the following functions by order of growth;that is, find an arrangement of the functions . Partition your list into equivalence classes such that functions f(n) and g(n) are in the same class if and only if .
b.Give an example of a single nonnegative function f(n) such that for all functions gi(n) in part (1), f(n) is neither nor .
The order is thus:
The asked function can be:
3.4 Asymptotic notation properties
3.5 Variations on O and Ω
3.6 Iterated functions
算法导论第三版 第3章习题答案相关推荐
- 算法导论第三版 第15章习题答案
2020/11/18:初稿,增加Python代码实现,修订参考文献部分错误(如15.1的第4题) 参考文献: https://walkccc.github.io/CLRS/Chap15/ https: ...
- 算法导论第三版 第2章习题答案
2020/10/27: 增加伪代码相应的Python实现代码. 2020/11/13:修订第2节第3题的bug. 参考文献:https://ita.skanev.com/ 2 Getting Star ...
- 算法导论第三版第十一章11.1-4
算法导论第三版第十一章11.1-4 我们希望在一个非常大的数组上,通过利用直接寻址的方式来实现一个字典.开始时,该数组中可能包含一些无用信息,但要堆整个数组进行初始化时不太实际的,因为该数组的规模太大 ...
- 算法导论第三版第8章思考题
8-1 a. 因为对于每一种输入,不可能能够到达同一片叶子,所以一共有 n! n!片子是可以到达的.其次因为输入完全随机,每种输入概率相等且到叶子结点的路径是固定的,这 n! n!个叶子结点的概率也是 ...
- 带权中位数-算法导论第三版第九章思考题9-2
带权中位数-算法导论第三版第九章思考题9-2 b 时间复杂度O(nlgn) float find_median_with_weights_b(float *array,int length) {qui ...
- 算法导论第三版第二章思考题答案
算法导论第三版第二章思考题答案 第二章思考题 算法导论第三版第二章思考题答案 2.1 2.2 2.3 2.4 汇总传送门 2.1 #include<iostream> using name ...
- 算法导论第三版3.1答案
算法导论第三版3.1答案 这一章数学公式实在太多了..打不过来,为了节约时间就用纸笔写了. 2.2 算法导论第三版3.1答案 汇总传送门 汇总传送门 链接: [算法导论习题答案汇总]
- 给出TREE_INSERT过程的非递归版本(算法导论第三版12.3-1)
给出TREE_INSERT过程的非递归版本(算法导论第三版12.3-1) template<typename T> void insert_recursive(BinaryTree< ...
- 写出TREE-PREDECESSOR的伪代码(算法导论第三版12.2-3)
写出TREE-PREDECESSOR的伪代码(算法导论第三版12.2-3) TREE-PREDECESSOR(x)if x.left != NILreturn TREE-MAXIMUM(x.left) ...
- 写出TREE-MINIMUM 和TREE-MAXIMUM的递归版本(算法导论第三版12.2-2)
写出TREE-MINIMUM 和TREE-MAXIMUM的递归版本(算法导论第三版12.2-2) template<typename T> BinaryTreeNode<T>* ...
最新文章
- BSP场景管理方法简介
- [您有新的未分配科技点]可,可,可持久化!?------0-1Trie和可持久化Trie普及版讲解...
- Leangoo背景更新-看板背景任你选!!!
- 小学生 python教程-Python最佳学习路线图
- easyui required 提交验证
- 50道练习带你玩转Pandas
- 学习angularjs的内置API函数
- pymol怎么做底物口袋表面_怎么从文献中发掘一篇新文章?
- Final Michael Scofield
- linux sudo 命令权限,linux su和sudo命令的区别
- 解决Linux下ArcGIS Server的Tomcat不稳定问题,nginx配置反向代理时的一个小问题
- 拓端tecdat|R语言stan泊松回归Poisson regression
- python修改app定位_APP自动化中三大定位工具
- 详解VMware虚拟机中添加新硬盘并挂载的方法
- phpmyadmin mysql配置_phpmyadmin配置方式
- LDA变分法和采样法
- 从区块链到DAG(三)--DAG共识之SPECTRE协议
- DLNA(明基的返校讲座)
- 联想TD350服务器主板型号,【新品】塔式机身 联想ThinkServer TD350
- objective-c delegate
热门文章
- 华为交换机专用堆叠电缆连线指导
- ToStringBuilder
- 《Head First 设计模式》例子的C++实现(2 观察者模式)
- 三级数据库知识点总结
- 蓝桥杯代码测评使用指南
- Skype国际版下载方法
- java转码工具_java转码工具native2ascii
- 游戏思考04补充:网络游戏同步算法的理解(参考网易雷火jerish的文章,未完待续7/23,参考文献附尾,物理同步已更新完)
- vb.net oracle数据库,vb.net 如何与oracle数据库连接
- 路由分析软件——VisualRoute v14.0c