Example 1.13: Q Theta
The function f(n) is Q(g(n)) iff there exists positive constants c1 , c2
and n0 such
that c1g(n) < f(n) <
c2g(n) for all n, n > n0
Notice – it is the same n0
The function 3n+2 = Q (n) as
3n + 2 > 3n for n > 2 and
3n + 2 < 4n for n > 2 so c1 = 3 , c2 = 4, and n0 = 2
3n + 3 = Q (n)
10n2 + 4n + 2 = Q (n2)
6 * 2n + n2 = Q (2n)
10 * log n + 4 = Q (log n)
Observe also that
3n + 2 != Q (1)
3n + 3 != Q (n2)
10n2 + 4n + 2 != Q (n)
10n2 + 4n + 2 != Q (1)
6 * 2n + n2 != Q (n2)
6 * 2n + n2 != Q (n100)
6 * 2n + n2 ! = Q (1)