Tutorial 3 Solutions
Tutorial 3 Solutions
Recursions
Solutions
Solution. For the upper bound, we guess T (n) ≤ cn log n and make the induction assumption
when 1 − 2c ≥ c, so we choose c = 1/3. The base case: T (2) = 2T (1) + 2 = 4 ≥ (1/3)2 log 2.
3 Master method.
Use the master method to give tight asymptotic bounds for the following recurrences.
1. T (n) = T (n/2) + Θ(1)
2. T (n) = 2T (n/2) + n log n
3. T (n) = 3T (n/2) + n2/3
2. a = 2, b = 2, α = log2 2 = 1, f (n) = n log n. None of the cases applies and the recurrence cannot be
solved using the Master method.
3. a = 3, b = 2, α = log2 3 ≈ 1.585, f (n) = n2/3 . Then f (n) = O(nα−ϵ ) for ϵ = 0.1 and the first case
applies: T (n) = Θ(nα ) = Θ(nlog2 3 ).
4. a = 2, b = 4, α = log4 2 = 1/2, f (n) = n7/3 . Then f (n) = Ω(nα+ϵ ) for ϵ = 0.1 and the third case
applies if the regularity condition is satisfied:
Solution. We can define x = log n, which implies n = 2x . Replacing this into the definition of T we obtain:
√
T (n) = 2T ( n) + log n
T (2x ) = 2T (2x/2 ) + x
S(x) = 2S(x/2) + x
The solution to this recurrence is S(x) = Θ(x log x), therefore T (n) = Θ(log n log log n).