Tut-1 Solution
Tut-1 Solution
General Instructions: Argue logically. Write it in a manner that explains your logic very
clearly. Do not miss steps in between.
Q1 Prove the following function is Θ(n4 ). T (n) = 2n4 − 20n3 − 200n2 + 500n + 5000
Solution 1
Thus for n ≥ 100, T (n) = O(n4 ) and T (n) = Ω(n4 ). Thus T (n) = Θ(n4 ).
Q2 Select the lowest Big-Oh complexity of each of these running time as given in table.
Q3 For each group of functions, sort the functions in increasing order of O complexity.
√ n
n X
3. f1 (n) = n n , f (n) = 2n , f3 (n) = n10 2 2 , f4 (n) = (i + 1) [Midsem 2022-23]
2
i=1
1
Solution 3
1. The correct ordering is f1 (n), f2 (n), f4 (n), f3 (n). Note that log n < nc ∀c > 0. Thus f1 (n) =
n0.999999 log n = O(n0.999999 n0.000001 ) = O(n) = O(f2 (n)).
Q4 Let f (n) and g(n) be asymptotically positive function. Prove or disprove the following conjecture.
Solution 4
1. Let f (n) = o(g(n)) ∩ ω(g(n)). We know that for any c1 > 0, c2 > 0,
3. This is not true. Let f (n) = n and g(n) = n2 . Then min(f (n), g(n)) = n. But f (n) + g(n) =
n + n2 ̸= Θ(n).
4. First note that f (n) + g(n) ≥ f (n) and f (n) + g(n) ≥ g(n). Thus f (n) + g(n) ≥ max(f (n), g(n)).
Therefore, f (n) + g(n) = Ω(max(f (n), g(n))).
Next, f (n) ≤ max(f (n), g(n)) and g(n) ≤ max(f (n), g(n)). Therefore, f (n)+g(n) ≤ 2(max(f (n), g(n))) =
O(max(f (n), g(n)). Hence f (n) + g(n) = Θ(max(f (n), g(n))).