Asymptotic
Asymptotic
Asymptotic
3/26/12
Asymptotic Equivalence
• Def:
⎛ f(n)⎞
f (n) : g(n) iff lim n→ ∞ ⎜ ⎟ =1
⎝ g(n)⎠
2 5 10 17
For example, n +1: n
2 2
(think: , , , ,...)
1 4 9 16
3/26/12
An example: Stirling’s formula
n
⎛n⎞
n! : ⎜ ⎟ 2π n ("Stirling'sapproxim ation")
⎝e⎠
3/26/12
Little-Oh: f = o(g)
• Def: f(n) = o(g(n)) iff
f(n)
lim =0
n→ ∞ g(n)
3/26/12
Big-Oh: O(∙)
• Asymptotic Order of Growth:
⎛ f(n)⎞
f (n) = O (g(n))iff lim ⎜ ⎟ <∞
n→ ∞ ⎝ g(n)⎠
3/26/12
Growth Order
3n + n + 2 = O (n )because
2 2
3n + n + 2
2
lim = 3< ∞
n→ ∞ n2
3/26/12
f = o(g) implies f = O(g)
f(n)
because if lim =0
n→ ∞ g(n)
f(n)
then lim <∞
n→ ∞ g(n)
3/26/12
Big-Omega
• f = Ω(g) means g = O(f)
• “f grows at least as quickly as g”
3/26/12
Big-Theta: 𝛩(∙)
“Same order of growth”
f (n) = Θ(g(n))
iff
f(n)= O (g(n))and g(n)= O (f(n))
orequivalently
f(n)= O (g(n))and f(n)= Ω(g(n))
So, for example,
3n + 2 = Θ(n )
2 2
3/26/12
Rough Paraphrase
• f∼g: f and g grow to be roughly equal
• f=o(g): f grows more slowly than g
• f=O(g): f grows at most as quickly as g
• f=Ω(g): f grows at least as quickly as g
• f=𝛩(g): f and g grow at the same rate
3/26/12
Equivalent Defn of O(∙)
“From some point on, the value of f
is at most a constant multiple of the
value of g”
f (n) = O (g(n))iff
∃c,n0 such that∀n ≥n0 :
f(n)≤c⋅g(n)
3/26/12
Three Concrete Examples
• Polynomials
• Logarithmic functions
• Exponential functions
3/26/12
Polynomials
• A (univariate) polynomial is a function such as f(n) =
3n5+2n2-n+2 (for all natural numbers n)
• This is a polynomial of degree 5 (the largest
exponent)
d
• Or in general f (n) = ∑cini
i=0
• Theorem:
– If a<b then any polynomial of degree a is o(any
polynomial of degree b)
– If a≤b then any polynomial of degree a is O(any
polynomial of degree b)
3/26/12
Logarithmic Functions
• A function f is logarithmic if it is Θ(logbn) for
some constant b.
• Theorem: All logarithmic functions are Θ() of
each other, and are Θ(any logarithmic function
of a polynomial)
• Theorem: Any logarithmic function is o(any
polynomial)
3/26/12
Exponential Functions
• A function is exponential if it is Θ(cn) for some
constant c>1.
• Theorem: Any polynomial is o(any
exponential)
• If c<d then cn=o(dn).
3/26/12
Growth Rates and Analysis of Algorithms
3/26/12