



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Key points of this note are: Asymptotic, Notation, Bound, Big O, Omega, Time, Upper, Lower, Hypothesis, Limit Rule, Constants.
Typology: Study notes
1 / 5
This page cannot be seen from the preview
Don't miss anything!




You may be asking that we continue to use the notation Θ() but have never defined it. Let’s remedy this now. Given any function g(n), we define Θ(g(n)) to be a set of functions that asymptotically equivalent to g(n). Formally:
Θ(g(n)) = {f(n) | there exist positive constants c 1 , c 2 and n 0 such that 0 ≤ c 1 g(n) ≤ f(n) ≤ c 2 g(n) for all n ≥ n 0 }
This is written as “f(n) ∈ Θ(g(n))” That is, f(n) and g(n) are asymptotically equivalent. This means that they have essentially the same growth rates for large n. For example, functions like
n − 10 log n)
are all asymptotically equivalent. As n becomes large, the dominant (fastest growing) term is some constant times n^2.
Consider the function f(n) = 8n^2 + 2n − 3
Our informal rule of keeping the largest term and ignoring the constant suggests that f(n) ∈ Θ(n^2 ). Let’s see why this bears out formally. We need to show two things for
f(n) = 8n^2 + 2n − 3
Lower bound f(n) = 8n^2 + 2n − 3 grows asymptotically at least as fast as n^2 ,
23
both the upper and lower bounds. The lower bound is satisfied because f(n) = 8n^2 + 2n − 3 does grow at least as fast asymptotically as n. But the upper bound is false. Upper bounds requires that there exist positive constants c 2 and n 0 such that f(n) ≤ c 2 n for all n ≥ n 0.
Informally we know that f(n) = 8n^2 + 2n − 3 will eventually exceed c 2 n no matter how large we make c 2. To see this, suppose we assume that constants c 2 and n 0 did exist such that 8n^2 + 2n − 3 ≤ c 2 n for all n ≥ n 0 Since this is true for all sufficiently large n then it must be true in the limit as n tends to infinity. If we divide both sides by n, we have
nlim→∞
8n + 2 −
n
≤ c 2.
It is easy to see that in the limit, the left side tends to ∞. So, no matter how large c 2 is, the statement is violated. Thus f(n) 6 ∈ Θ(n).
Let’s show that f(n) 6 ∈ Θ(n^3 ). The idea would be to show that the lower bound f(n) ≥ c 1 n^3 for all n ≥ n 0 is violated. (c 1 and n 0 are positive constants). Informally we know this to be true because any cubic function will overtake a quadratic.
If we divide both sides by n^3 :
lim n→∞
n
n^2
n^3
≥ c 1
The left side tends to 0. The only way to satisfy this is to set c 1 = 0. But by hypothesis, c 1 is positive. This means that f(n) 6 ∈ Θ(n^3 ).
The definition of Θ-notation relies on proving both a lower and upper asymptotic bound. Sometimes we only interested in proving one bound or the other. The O-notation is used to state only the asymptotic upper bounds.
O(g(n)) = {f(n) | there exist positive constants c and n 0 such that 0 ≤ f(n) ≤ cg(n) for all n ≥ n 0 }
The Ω-notation allows us to state only the asymptotic lower bounds.
Ω(g(n)) = {f(n) | there exist positive constants c and n 0 such that 0 ≤ cg(n) ≤ f(n) for all n ≥ n 0 }
The three notations:
Θ(g(n)) : 0 ≤ c 1 g(n) ≤ f(n) ≤ c 2 g(n) O(g(n)) : 0 ≤ f(n) ≤ cg(n) Ω(g(n)) : 0 ≤ cg(n) ≤ f(n) for all n ≥ n 0
These definitions suggest an alternative way of showing the asymptotic behavior. We can use limits for define the asymptotic behavior. Limit rule for Θ-notation:
lim n→∞
f(n) g(n)
= c,
for some constant c > 0 (strictly positive but not infinity) then f(n) ∈ Θ(g(n)). Similarly, the limit rule for O-notation is
nlim→∞
f(n) g(n)
= c,
for some constant c ≥ 0 (nonnegative but not infinite) then f(n) ∈ O(g(n)) and limit rule for Ω-notation:
lim n→∞
f(n) g(n)
(either a strictly positive constant or infinity) then f(n) ∈ Ω(g(n)).
Here is a list of common asymptotic running times: