DAA (CS14103)
Practice Questions on Asymptotic Notations
Department of Computer Science and Engineering
Big Oh (O)
1. Let f(n)=7n+8 and g(n)=n. Is f(n) ∈ O(g(n))?
2. Find the upper bound for f(n) = n4+100n2+50
Big Oh (O)
1. Let f(n)=7n+8 and g(n)=n. Is f(n) ∈ O(g(n))?
● For 7n + 8 ∈ O(n), we have to find c and n0 such that 7n + 8 ≤ c·n, ∀n ≥ n0.
● By inspection, it’s clear that c must be larger than 7. Let c = 8. Now we need a suitable
n0.
● In this case, f(8) = 8·g(8). Because the definition of O() requires that f(n) ≤ c·g(n), we
can select n0 = 8, or any integer above 8 – they will all work.
● We have identified values for the constants c and n0 such that 7n+8 is ≤ c·n for every
n≥n0, so we can say that 7n + 8 is O(n).
Big Omega (Ω): Examples
1. Prove f(n) = 100n + 8 not equal to Ω(n2)
2. Prove that 2n3 - 7n + 1 is in Ω(n3)
Big Theta (Θ)
1. Prove that 2n3 - 7n + 1 = Θ(n3)
Little Oh (o)
1. Is 7n + 8 ∈ o(n2)?
Little Omega (ω)
1. Prove that 4n + 6 ∈ ω(1);