Beruflich Dokumente
Kultur Dokumente
1 solution
2017/08/30
1. (Page 8, Q 0.1. Only (f), (i), (l), (m) and (n) required.)
a. By limit, we have
𝑓(𝑛) 𝑛 − 100
lim = = 1
$→& 𝑔(𝑛) 𝑛 − 200
leading to 𝑓 𝑛 = 𝜃(𝑔 𝑛 )
b. By limit, we have
𝑓(𝑛) 𝑛2/4 1
lim = 4/5 = 2/6 ≤ 1
$→& 𝑔(𝑛) 𝑛 𝑛
leading to 𝑓 𝑛 = 𝑂(𝑔(𝑛))
c. Since n dominates log(n), and n dominates (log(n))2 by
log 𝑛 = 2 log 𝑛 < 2 𝑛
By limit, we have
𝑓(𝑛) 100𝑛 + log 𝑛 100𝑛
lim = = = 100
$→& 𝑔(𝑛) 𝑛 + (log 𝑛)4 𝑛
leading to 𝑓 𝑛 = 𝜃(𝑔 𝑛 )
d. By limit, we have
𝑓(𝑛) n log 𝑛 log 𝑛 log 𝑛 1
lim = = = =
$→& 𝑔(𝑛) 10n log 10𝑛 10 log 10𝑛 10 log 𝑛 + 10 log 10 10
leading to 𝑓 𝑛 = 𝜃(𝑔 𝑛 )
e. By limit, we have
𝑓(𝑛) log 2𝑛 log 𝑛 + log 2
lim = = = 1
$→& 𝑔(𝑛) log 3𝑛 log 𝑛 + log 3
leading to 𝑓 𝑛 = 𝜃(𝑔 𝑛 )
f. By limit, we have
𝑓(𝑛) 10 log 𝑛 10 log 𝑛
lim = = = 5
$→& 𝑔(𝑛) log 𝑛4 2 log 𝑛
leading to 𝑓 𝑛 = 𝜃 𝑔 𝑛
g. By limit, we have
𝑓(𝑛) 𝑛2.B2 𝑛B.BBC 4
lim = =( )
$→& 𝑔(𝑛) 𝑛 (log 𝑛)4 log 𝑛
Since polynomial function always dominates logarithmic function, which is
because that polynomial function always has larger growth than logarithmic
function when n goes infinity, so
𝑓(𝑛) 𝑛2.B2 𝑛B.BBC 4
lim = = ( ) > 1
$→& 𝑔(𝑛) 𝑛 (log 𝑛)4 log 𝑛
leading to 𝑓 𝑛 = Ω 𝑔 𝑛
h. By limit, we have
𝑓(𝑛) 𝑛4 / log 𝑛 𝑛 𝑛 𝑛
lim = = < < = 1
$→& 𝑔(𝑛) 𝑛 (log 𝑛)4 (log 𝑛)5 (log 𝑛)5 ( 𝑛)5
F F
leading to 𝑓 𝑛 = 𝑂 𝑔 𝑛
i. By limit, we have
𝑓(𝑛) 𝑛B.2 𝑛B.B2 2B
lim = = ( )
$→& 𝑔(𝑛) (log 𝑛)2B log 𝑛
Since polynomial function always dominates logarithmic function, which is
because that polynomial function always has larger growth than logarithmic
function when n goes infinity, so
𝑓(𝑛) 𝑛B.2 𝑛B.B2 2B
lim = =( ) > 1
$→& 𝑔(𝑛) (log 𝑛)2B log 𝑛
leading to 𝑓 𝑛 = Ω 𝑔 𝑛
j. Since
log(𝑎HIJ K ) = log 𝑎 log 𝑏 = log(𝑏 HIJ M )
we know
𝑎HIJ K = 𝑏 HIJ M
so
𝑓 𝑛 = (log 𝑛)HIJ $ = 𝑛HIJ HIJ $
By limit, we have
𝑓(𝑛) 𝑛HIJ HIJ $
lim = = 𝑛HIJ HIJ $N2 log 𝑛 > 1
$→& 𝑔(𝑛) 𝑛/ log 𝑛
leading to 𝑓 𝑛 = Ω 𝑔 𝑛
k. By limit, we have
𝑓(𝑛) 𝑛 𝑛2/6 5
lim = = ( ) > 1
$→& 𝑔(𝑛) log 𝑛5 log 𝑛
leading to 𝑓 𝑛 = Ω 𝑔 𝑛
l. Since
log(𝑎HIJ K ) = log 𝑎 log 𝑏 = log(𝑏 HIJ M )
we know
𝑎HIJ K = 𝑏 HIJ M
so
𝑓 𝑛 = 5HIJO $ = 𝑛HIJO C
By limit, we have
𝑓(𝑛) 𝑛2/4 𝑛2/4
lim = HIJ $ = HIJ C < 1
$→& 𝑔(𝑛) 5 O 𝑛 O
leading to 𝑓 𝑛 = 𝑂 𝑔 𝑛
m. By limit, we have
𝑓(𝑛) 𝑛2$ 2
lim = $ = 𝑛( )$ < 1
$→& 𝑔(𝑛) 3 3
leading to 𝑓 𝑛 = 𝑂 𝑔 𝑛
n. By limit, we have
𝑓(𝑛) 2$ 1
lim = $P2 =
$→& 𝑔(𝑛) 2 2
leading to 𝑓 𝑛 = 𝜃 𝑔 𝑛
o. Since
𝑛! > 2$
So by limit, we have
𝑓(𝑛) 𝑛!
lim = $ > 1
$→& 𝑔(𝑛) 2
leading to 𝑓 𝑛 = Ω 𝑔 𝑛
p. Since
log(𝑎HIJ K ) = log 𝑎 log 𝑏 = log(𝑏 HIJ M )
we know
𝑎HIJ K = 𝑏 HIJ M
so
𝑓 𝑛 = log 𝑛 HIJ $ = 𝑛HIJ HIJ $
and
O
𝑔 𝑛 = 2(HIJO $) = 2HIJO $∗HIJO $ = (2HIJO $ )HIJO $ = (𝑛HIJO 4 )HIJO $ = 𝑛HIJO $
By limit, we have
𝑓(𝑛) (log 𝑛)HIJ $ 𝑛HIJ HIJ $ 𝑛HIJ HIJ $
lim = (HIJ $)O = HIJ $ = HIJ $/ HIJ 4 < 1
$→& 𝑔(𝑛) 2 O 𝑛 O 𝑛
leading to 𝑓 𝑛 = 𝑂 𝑔 𝑛
q. By limit, we have
$ T $ T
𝑓(𝑛) UV2 𝑖 UV2 𝑛 𝑛 ∗ 𝑛T
lim = TP2 < TP2 < TP2 = 1
$→& 𝑔(𝑛) 𝑛 𝑛 𝑛
𝑛 T
$
$ T $
𝑓(𝑛) UV2 𝑖 4 2
UV
lim = ≥ = ⋯
$→& 𝑔(𝑛) 𝑛TP2 𝑛TP2
leading to 𝑓 𝑛 = 𝑂 𝑔 𝑛
2. (Page 9, Q 0.2.)
Based on
1 − 𝑐 $P2
g n = 1 + 𝑐 + 𝑐4 + ⋯ + 𝑐$ =
1−𝑐
a. If c < 1,
1
lim 𝑔 𝑛 = =𝜃 1
$→& 1−𝑐
b. If c = 1,
𝑔 𝑛 = 𝑛 = 𝜃(𝑛)
c. If c > 1,
𝑐 $P2 − 1
lim 𝑔(𝑛) = = 𝜃(𝑐 $ )
$→& 𝑐−1
3. (Page 9, Q 0.3)
a. When n = 6,
𝐹6 = 13 ≥ 8 = 2B.C∗6
When n = 7,
𝐹\ = 21 ≥ 8 2 = 2B.C∗\
When n = k, assume
𝐹T ≥ 2B.CT
So when n = k + 2,
𝐹TP4 = 𝐹TP2 + 𝐹T ≥ 2𝐹T ≥ 2 ∗ 2B.CT = 2B.C(TP4)
Proved.
b. When n = 0,
𝐹B = 0 ≤ 2]∗B (𝑐 ∈ ℝ)
When n = 1,
𝐹2 = 1 ≤ 2]∗2 (𝑐 ≥ 0)
When n = k (𝑘 ≥ 2), assume there is a constant c, which
𝐹T ≤ 2]T
When n = k + 1 (𝑘 ≥ 2),
𝐹TP2 = 𝐹T +𝐹TN2
= 2𝐹TN2 + 𝐹TN4
≤ 3𝐹TN2
≤ 3 ∗ 2] TN2
= 2] TN2 PHIJO 5
bcdO F
= 2](TN2P e
)
So when
log 4 3
−1 + ≤ 1
𝑐
log 4 3
𝑐≥
2
Finally, when
log 4 3
≤ 𝑐 < 1
2
the induction will work, which means 𝐹$ = 0 ≤ 2]$ .
c. Assume there is a constant m>0, which makes 𝐹$ = Ω(2]$ ).
When n = 0,
𝐹B = 0 ≥ 𝑚 ∗ 2]∗B
When n = 1,
𝐹2 = 1 ≥ 𝑚 ∗ 2]∗2
When n = k (𝑘 ≥ 2), assume there is a constant c, which
𝐹T ≥ 𝑚 ∗ 2]T
and
𝐹TP2 ≥ 𝑚 ∗ 2](TP2)
When n = k + 2 (𝑘 ≥ 2),
𝐹TP4 = 𝐹TP2 +𝐹T
≥ 𝑚 ∗ 2] TP2 + 𝑚 ∗ 2]T
= 𝑚 ∗ 2]T ∗ (2] + 1)
So set
2]T ∗ 2] + 1 = 2](TP4)
2] + 1 = 24]
(2] )4 − 2] − 1 = 0
1± 5
2] =
2
So finally, the largest c can be found is
5+1
𝑐 = log 4
2
the induction will work, which means 𝐹$ = 0 ≤ 2]$ .
4. (Page 9, Q 0.4)
a. Assume two 2x2 matrixes
22 24
𝐴 = 𝐴42 𝐴44
𝐴 𝐴
,
22
𝐵 = 𝐵42 𝐵24
𝐵 𝐵44
and
22
𝐶 = 𝐶 42 𝐶 24
𝐶 𝐶 44
Define 8 intermediate values calculated from 8 multiplications
𝑋2 = 𝐴22 ∗ 𝐵22
𝑋4 = 𝐴24 ∗ 𝐵42
𝑋5 = 𝐴22 ∗ 𝐵24
𝑋l = 𝐴24 ∗ 𝐵44
𝑋C = 𝐴42 ∗ 𝐵22
𝑋6 = 𝐴42 ∗ 𝐵42
𝑋\ = 𝐴42 ∗ 𝐵24
𝑋m = 𝐴44 ∗ 𝐵44
and the results come from 4 additions
𝐶 22 = 𝑋2 + 𝑋4
𝐶 24 = 𝑋5 + 𝑋l
𝐶 42 = 𝑋C + 𝑋6
𝐶 44 = 𝑋\ + 𝑋m
b. Assume n is the power of 2, the multiplication of 𝑋 $ can be represented as a tree
below,
𝑋$
𝑋 $/4 𝑋 $/4
……
𝑋2 𝑋2 …… 𝑋2 𝑋2
Only one node in each level needs to be computed by one matrix
multiplication. Since there are 1+log2n levels in the tree, we only need to
perform O (log n) matrix multiplications.