Professional Documents
Culture Documents
Structures I
Lecture 3:
Growth of functions;
Asymptotic notations: Θ, O, o, Ω, and ω.
• Informally:
the order of growth of the fastest growing term
Θ-notation
• For a given function g(n), we denote by Θ(g(n)) the set of
functions:
Θ(g(n)) = {f(n): there exist positive constants c1, c2, and n0 such that
0 ≤ c1 g(n) ≤ f(n) ≤ c2g(n) for all n ≥ n0}
• Example
g(n) = n, f(n) = 2n+5, c1 = 1, c2 = 3, n0 = 5
0 ≤ n ≤ 2n+5 ≤ 3n, for n ≥ n0
• Exercise
g(n) = n2, f(n) = 2n2+3n+5, find c1, c2, n0, so that:
0 ≤ c1n2 ≤ 2n2+3n+5 ≤ c2n2, for n ≥ n0.
Θ-notation (cont.)
• Examples
f(n)=n2+n ∈ O(n3); f(n)=n3 + 5∈ O(n3 log n); f(n) = n5 ∈ O(2n);
f(n)=n3+2n2 + 5 ∈ O(n3)
O-notation (cont.)
f ( n)
lim =0
n →∞ g ( n)
• Examples
2n ∈ o(n2)
2n2 ∉ o(n2)
ω-notation
• ω-notation is used to denote a lower bound that is not
asymptotically tight.
f ( n)
lim =∞
n →∞ g ( n)
• Examples
n2 / 2 ∈ ω(n)
n2 / 2 ∉ ω(n2)
Notations: summary
Notation Similar to