CS148 Module 2 - Asymptotic Notation
CS148 Module 2 - Asymptotic Notation
ASYMPTOTIC ANALYSIS
Ο (Big Oh)
Ω (Big Omega)
Θ (Theta)
Ex. array access has this characteristic. A[i] takes the same
T(n) = O(nk).
This is called polynomial growth.
T(n) = O(2n)
This is called exponential growth.
Example 1:
Using basic definition, we show that 3n2 + 10n = Ο(n2)
Consider, 10 ≤ n for n ≥ 10
10n ≤ n2 for n ≥ 10
3n2 + 10n ≤ 3n2 + n2 for n ≥ 10
= 4n2
3n2 + 10n ≤ c·n2 for n ≥ n0 where c=4 and n0 = 10
Therefore, it follows from the basic definition that
3n2 + 10n = Ο(n2)
Solution:
f(n) < 2n7 – 6n5 + 10n2
≤ 2n7 – 6n7 + 10n7
= 18n7
thus, with c=18 we have shown that f(n) = O(n7)
Example 1:
Using basic definition, we show that n2 - 10n = Ω(n2)
For, n ≥ n / 2 for n ≥ 0
n – 10 ≥ n / (2 x 10) for n ≥ 10
= n / 20
n2 - 10n ≥ n2 / 20 for n ≥ 10
n2 - 10n ≥ c·n2 for n ≥ n0 where c=1 / 20 and n0 = 10
Therefore, by basic definition,
n2 - 10n = Ω(n2).
Example 1
Example 2
For n ≥ 9, the
function 9n2 / 50
falls below the
function 3n2 - 25n.
Venn diagram:
f n O g n ab
f n g n ab
f n g n ab
f n o g n ab
f n g n ab
(f(n))
f(n)
(f(n))
(f(n))
n0
logarithms:
logb(xy) = logbx + logby
logb (x/y) = logbx - logby
logbxa = alogbx
logba = logxa/logxb
exponentials:
a(b+c) = abac
abc = (ab)c
ab /ac = a(b-c)
www.eshikshak.co.in