CSCI 3110 Assignment 6 Solutions: n ≈ n nlogn=O n n − ϵ where ϵ = (log − log
CSCI 3110 Assignment 6 Solutions: n ≈ n nlogn=O n n − ϵ where ϵ = (log − log
1. (14 points) Solve each of the following recurrences using the Master Theorem or, if
the Master Theorem is not applicable to the recurrence, state why. If the Master
Theorem applies, state which case is applicable and show that the recurrence satisfies
the conditions of this case.
2. (12 pts) Solve each of the following recurrences using substitution or a recursion tree.
Do not only state your solution—Show how you obtained it. That is, if you use
substitution, you must present the complete inductive proof that your solution is
correct. If you use a recursion tree, show the recursion tree and discuss how you
obtained the solution from the tree. Note that you are to prove matching upper and
lower bounds.
cn2 cn2 cn2 cn2 cn2 cn2 cn2 cn2 cn2 cn2 cn2 cn2 cn2 cn2 cn2 cn2 cn2
f ( n4 ) = 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16 16
16 · 16 = cn2
b b b b b b b b bn2
P
log2 n
T (n) = i=0 cn2 + bn2 = cn2 log2 n + bn2 = Θ(n2 lg n)
The depth of the tree is log2 n. Thus there are 4log2 n = nlog2 4 = n2 leaves, and
their cost is Θ (n2 ). The cost of the ith non-leaf level is:
( n )2
4i c (1)
2i
4i 2
=c n (2)
22i
4i
= c i n2 (3)
4
= cn2 (4)
( 2) ∑
log2 n
Θ n + cn2 (5)
( ) i=0
= Θ n2 + log2 n(cn2 ) (6)
( )
= Θ n2 lg n (7)