算法导论第三版 第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:

\begin{align*} \exists n_1, n_2: & f(n) \geq 0 & \text{for } n > n_1 \\ & g(n) \geq 0 & \text{for } n > n_2 \end{align*}

Let n_0 = max(n_1, n_2) , some obvious things for n > n_0:

f(n) \leq \max(f(n), g(n)) \\ g(n) \leq \max(f(n), g(n)) \\ \big(f(n) + g(n)\big)/2 \leq \max(f(n), g(n)) \\ \max(f(n), g(n)) \leq f(n) + g(n)

From the last two inequalities, we get:

0 \leq \frac{1}{2}\big(f(n) + g(n)\big) \leq \max\big(f(n), g(n)\big) \leq f(n) + g(n) \quad \text{for } n > n_0

Which is the definition of\Theta(f(n) + g(n)) with c_1 = 1/2, c_2 = 1

2.Show that for any real constants a and b, where b>0,(n + a)^b = \Theta(n^b)

(n + a)^b = \binom{n}0n^b + \binom{n}1n^{b-1}b + \cdots + \binom{n}0a^b

The most significant term is n^b and this is obviously polynomially tightly bound.

3.Explain why the statement, "The running time of algorithm A is at least O(n^2) is meaningless.

The O-notation provides an upper bound. "At least" implies a lower bound.

4.Is 2^{n+1} = O(2^n) ? Is 2^{2n} = O(2^n) ?

Yes, because if we choose 2 for both constants in the O-notation definition, we get an equality.

No, because \nexists c: 2^n \cdot 2^n \leq c 2^n

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:

\begin{align*} O(g(n, m) = \lbrace f(n, m): &\text{there exist positive constants } c, n_0, \text{ and } m_0 \\ &\text{such that } 0 \leq f(n, m) \leq cg(n, m) \\ &\text{for all } n \geq n_0 \text{ or } m \geq m_0. \end{align*}

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)

\begin{align*} a^{\log_bc} = a^{\frac{\log_ac}{\log_ab}} = \big(a^{\log_ac})^\frac{1}{\log_ab} = c^{\log_ba} \end{align*}

3.Prove equation (3.19). Also prove that n!=ω(2^n) and n!=o(n^n).

 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:
f(n) \leq cn^k

and take the logarithm of each side, we get:

\lg{f(n)} \leq \lg{c} + k\lg{n}

Thus, a function is polynomially bound if \lg{f(n)} = \O(\lg{n})

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) = o((\lg{\lg{n}})^2)o(\lg^2\lg(n))   = ο(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 \lg^b{n}o(n^a). Substitute lgn for n, 2 for b, and 1 for a, giving\lg^2{(\lg{n})}=o(lgn).

Therefore, lg(⌈lglgn⌉!) = Ο(lgn), and so ⌈lglgn⌉! is polynomially bounded.

5. Which is asymptotically larger:\lg(\lg\textup{*}{n})or\lg\textup{*}(\lg{n})

The second, because:

\lg\textup{*}(\lg{n}) = \lg^*n - 1 > \lg(\lg\textup{*}(n))

6.Show that the golden ratio ϕ and its conjugate \hat \phi both satisfy the equation x^2 = x + 1.

7.Proove by induction that the ith Fibonacci number satisfies the equality

F_i = \frac{\phi^i - \hat{\phi^i}}{\sqrt5}

Base:

\frac{\phi^0 - \hat{\phi^0}}{\sqrt{5}} = \frac{1 - 1}{\sqrt{5}} = 0 = F_0

\frac{\phi - \hat{\phi}}{\sqrt{5}} = \frac{1 + \sqrt{5} - 1 + \sqrt{5}}{2\sqrt{5}} = 1 = F_1

Step:

F_{n + 2} = F_{n + 1} + F_n = \frac{\phi^{n+1} - \hat\phi^{n+1}}{\sqrt{5}} + \frac{\phi^n - \hat{\phi^n}}{\sqrt{5}} = \frac{\phi^n(\phi + 1) - \hat{\phi^n}(\hat\phi + 1)}{\sqrt{5}} = \frac{\phi^n\phi^2 - \hat{\phi^n}\hat{\phi^2}}{\sqrt{5}} = \frac{\phi^{n+2} + \hat\phi^{n+2}}{\sqrt{5}}

8.Show that k\ln{k} = \Theta(n) implies k = \Theta(n/\ln{n}).

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:lg(n!)=\Theta(nlgn)

3.3 Ordering by asymptotic growth rates. 

a.Rank the following functions by order of growth;that is, find an arrangement g_1, g_2, \ldots , g_{30} of the functions g_1 = \Omega(g_2), g_2 = \Omega(g_3), \ldots, g_{29} = \Omega(g_{30}). Partition your list into equivalence classes such that functions f(n) and g(n) are in the same class if and only if f(n) = \Theta(g(n)).

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 O(g_i(n)) nor \Omega(g_i(n)).

The order is thus:

  1. 1 = n^{1/\lg{n}}
  2. \lg(\lg^*n)
  3. \lg\textup{*}n \simeq \lg\textup{*}(\lg{n})

The asked function can be:2^{2^{(n + 1)\sin{x}}}

3.4 Asymptotic notation properties

3.5 Variations on O and Ω

3.6 Iterated functions

  • 3
    点赞
  • 61
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
算法导论第三版中文版 pdf高清版 在有关算法的书中,有一些叙述非常严谨,但不够全面;另一些涉及了大量的题材,但又缺乏严谨性。算法导论第三版中文版将严谨性和全面性融为一体,深入讨论各类算法,并着力使这些算法的设计和分析能为各个层次的读者接受。全书各自成体系,可以作为独立的学习单元;算法以英语和伪代码的形式描述,具备初步程序设计经验的人就能看懂;说明和解释力求浅显易懂,不失深度和数学严谨性。全书选材经典、内容丰富、结构合理、逻辑清晰,对本科生的数据结构课程和研究生的算法课程都是非常实用的教材,在IT专业人员的职业生涯中,算法导论第三版也是一本案头必备的参考书或工程实践手册。 第3版的主要变化 1、新增了van Emde Boas树和多线程算法,并且将矩阵基础移至附录。 2、修订了递归式(现在称为“分治策略”)那一的内容,更广泛地覆盖分治法。 3、移除两很少讲授的内容:二项堆和排序网络。 4、修订了动态规划和贪心算法相关内容。 5、流网络相关材料现在基于边上的全部流。 6、由于关于矩阵基础和Strassen算法的材料移到了其他,矩阵运算这一的内容所占篇幅更小。 7、修改了对Knuth-Morris-Pratt字符串匹配算法的讨论。 8、新增100道练习和28道思考题,还更新并补充了参考文献。
### 回答1: 《算法导论第三版答案PDF是一本非常有价值的资料,其中包含了本书提出的各种算法问题的详细解答。这本答案PDF的编写者经过了严格的选择和考核,他们大都是计算机科学领域的权威专家和学者,拥有丰富的经验和深入的知识。 这本答案PDF主要分为三个部分,第一部分是对于算法的分析和设计,第二部分是算法基础和数据结构,第三部分是高级主题和高级算法。每一节都有详尽的解答,从基本的数据结构,例如栈、队列和堆,到高级算法,例如线性规划和哈希表,每个问题都有详尽的解答,便于读者深入理解算法背后的原理和技巧。 该答案PDF还提供了大量的例子和练习题,让读者能够在学习过程中实时测试自己的理解和掌握程度。此外,该答案PDF还提供了许多实用的技巧、经验和应用场景,使读者能够更好地应用所学知识来解决实际的问题。 总的来说,《算法导论第三版答案PDF是一本非常有价值的资料,不仅能够帮助读者更加深入地理解算法的背后原理和技巧,还能够帮助读者应用所学知识来解决实际的问题。无论是计算机科学学生还是职业程序员,都可以从中受益匪浅。 ### 回答2: “算法导论第三版答案 pdf”指的是《算法导论》这本书的答案解析。这本书是计算机科学领域中一本非常重要的教材,其内容涵盖了算法设计、算法分析和算法实现三个方面。 由于《算法导论》中的题目非常经典,因此很多读者都希望可以得到书中题目的答案解析,以便更好地理解和应用其中的算法知识。 目前,网络上可以找到一些《算法导论答案解析的PDF文档。这些文档通常由一些对该书有深刻理解的计算机科学专家或者学术界人士撰写。这些答案解析包括书中大部分习题的解答和讨论,能够帮助读者更加深入地掌握其中的算法知识。 然而,需要注意的是,仅仅阅读答案解析是远远不够的。为了真正掌握《算法导论》中的算法知识,读者需要通过反复的练习和实践来加深理解,甚至可以自己设计算法并实现其代码。只有这样,才能真正掌握算法知识,提高自己的编程能力。 ### 回答3: 算法导论第三版答案 PDF是一本对算法导论第三版中的习题进行详细解答的参考书籍。该书可以帮助读者更好地理解和掌握算法导论这本指导性书籍中包含的众多算法和数据结构。 这本答案集涵盖了算法导论第三版中的全部习题,包括题目和答案。它涉及的主题包括渐进分析、排序和选择、数据结构(如堆、散列表、二叉搜索树等)、高级设计和分析技术(如贪心、动态规划、图算法和NP完备性)等。对于学习算法导论的人来说,这是一本非常有用的参考书。 此外,算法导论第三版答案PDF还提供了对习题解答的分析和讨论,这可以帮助读者更好地理解解题的过程和思路。通过阅读该书,读者可以加深对数据结构和算法的理解,提高自己解决问题的能力。因此,如果您正在学习算法导论或者需要更加深入地掌握里面的知识,这本答案集将是您的一个绝佳资源。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值