CPS616 Lab2 Solution

CPS 616 - W2017
Lab 2 - Asymptotic Efficiencies
SOLUTIONS
1. Solutions
Before answering any of the questions one needs to simplify the function f:
f(n) = 5nlog n2 = 10n log n because ∀a,b∈ℝ, log ab = b.log a
a.
10n log n ∈ O(n(log n2)2):
n(log n2)2 = n(2 log n)2 = 4n(log n)2
Find n0,c ∈ℝ such that ∀n>n0 |10n log n)|  c.| 4n(log n)2|
i.e. s.t. ∀n>n0 10  c. 4 (log n)
Simplifying on both sides
i.e. s.t. ∀n>n0 10/4c  log n
Simplifying on both sides
This inequality is true when n0=10 and c=10
b.
10n log n ∉ Ω(n2log n):
lim |
10𝑥 𝑙𝑜𝑔𝑥
𝑥→∞ 4𝑥(log 𝑥)2
c.
𝑥→∞ 4 log 𝑥
|=
10
1
lim
4 𝑥→∞ log 𝑥
=0
10n log n ∈ (nlog(n+1)3):
nlog(n+1)3 = 3nlog(n+1)
lim |
10𝑥 log 𝑥
|=
𝑥→∞ 3𝑥 log(𝑥+1)
=
d.
10
| = = lim |
10
lim |
10
lim
log 𝑥
=
3 𝑥−∞ log(𝑥+1)
1/(𝑥 𝑙𝑛10)
|=
3 𝑥→∞ 1/((𝑥+1)𝑙𝑛10)
10
lim
(log 𝑥)′
3 𝑥−∞ (log(𝑥+1))′
𝑥+1
10
𝑥
3
lim |
3 𝑥→∞
10
|=
by L’Hopital’s rule
𝑥
1
( lim |𝑥| + lim |𝑥|) =
𝑥→∞
𝑥→∞
10
3
(1 + 0) = 10/3
10n log n ∈ o(n2):
Lim |
𝑥→∞
10𝑥 log 𝑥
𝑥2
= 10 lim |
𝑥→∞
| = lim |
10 log 𝑥
𝑥→∞
1/(𝑥 𝑙𝑛10)
1
|=
𝑥
10
| = 10 lim |
𝑥→∞
log 𝑥
𝑥
| = 10 lim |
𝑥→∞
(log 𝑥)′
(𝑥)′
| by L’Hopital’s
rule
1
lim |𝑥| = 0
𝑙𝑛10 𝑥→∞
2. Solutions
a.
Θ(5n-1 . 2n+1) = Θ(4×10n-1) = Θ(0.4×10n) = Θ(10n)
b.
Θ(2n log(n+2) 2 × log(n/2)) = Θ(2n ×2log(n+2) × (log(n)-log(2)))
= Θ(n log(n+2)log (n)-log(2) n log(n+2)) = Θ(n (log(n))2 - n log(n)) = Θ(n (log n)2)
c.
Θ(√((n-1)(n3+1)) = Θ(√(n4-n3+n-1)) = Θ(√(n4) = Θ(n2)