Skip to content

Commit

Permalink
Merge pull request gzc#179 from DevDoggo/master
Browse files Browse the repository at this point in the history
Added English Answers to a few Questions in 3.1
  • Loading branch information
Zhenchao Gan authored Nov 28, 2017
2 parents 8da4287 + c94c8c0 commit 20d9f93
Showing 1 changed file with 33 additions and 5 deletions.
38 changes: 33 additions & 5 deletions C03-Growth-of-Functions/3.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,40 @@ Let f(n) and g(n) be asymptotically nonnegative functions. Using the basic defin
notation, prove that max(f(n), g(n)) = Θ(f(n) + g(n)).

### `Answer`
我们需要证明 c1(f(n) + g(n)) <= max(f(n), g(n)) <= c2(f(n) + g(n))

我们需要证明 c1(f(n) + g(n)) <= max(f(n), g(n)) <= c2(f(n) + g(n))

因为f和g都是非负函数,只需要令c1 = 0.5, c2 = 1即可.



English:

Use the definition of Θ-notation and set it up with the given values:

0 <= c1(f(n) + g(n)) <= max(f(n), g(n)) <= c2(f(n) + g(n))

---If we can Solve All inequalities, we can then use that as proof for the definition of Θ-notation.

c2 = 1: This holds because the Max must be lower than the sum of the two functions.

c1 = 1/2: This holds because the Max can at its lowest be equal to 1/2 of the Sum of the two functions.

0 <= c1(f(n) + g(n)) is trivial.

Thus, since all inequalities hold, we've proven that: max(f(n), g(n)) = Θ(f(n) + g(n)).



### Exercises 3.1-2
***
Show that for any real constants a and b, where b > 0,

![](http://latex.codecogs.com/gif.latex?\(n+a\)^b=\\Theta\(n^b\))

### `Answer`
需要证明 c1n^b <= (n+a)^b <= c2n^b

在 n > 2|a| 时, 令 c1 = 0.5, c2 = 2 即可.
需要证明 c1n^b <= (n+a)^b <= c2n^b

在 n > 2|a| 时, 令 c1 = 0.5, c2 = 2 即可.


### Exercises 3.1-3
Expand All @@ -37,6 +56,15 @@ Is ![](http://latex.codecogs.com/gif.latex?2^{n+1}=O\(2^n\)?)Is![](http://latex.

(2)不成立,假设存在常数c使得2^(2*n)<=c*2^n,则有2*n<=lg c+n,即n<=lg c,并不存在一个常数c使得这个不等式对n成立。

English:
for f(n) = O(g(n)), the definition of O-notation is:
0 <= f(n) <= c(g(n)) for all n > n0.

(1) 2^(n+1) = 2(2^n) <= c*2^n. If c = 2, the inequality holds and we prove 2^(n+1) = O(2^n) to be True! Answer: Yes.

(2) 2^2n = (2^n)^2. There is no possible constant c that can make 2^n into (2^n)^2. Thus, 2^2n =/= O(2^n). Answer: No.


### Exercises 3.1-5
***
Prove Theorem 3.1. *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
Expand Down

0 comments on commit 20d9f93

Please sign in to comment.