2. Asymptotic Notations
• Asymptotic running time of an algorithm is
defined in terms of functions.
• Asymptotic notation is useful describe the
running time of the algorithm.
• Asymptotic notations give time complexity as
“fastest possible”, “slowest possible” or “average
time”.
• Bigh Oh (Ο) , Omega (Ω) and Theta (Θ) notations
are useful to represent the asymptotic complexity
of algorithms.
3. Big oh Notation
• “O” represents the Big oh notation.
• “O” is a method of representing the upper
bound (longest amount of time) of
algorithm’s running time.
4. f(n) is O(g(n)) ≡∃C ∃ n0 ∀n (n > n0 → f(n) ≤ C g(n))
• Let f(n) and g(n) be two non-negative
functions. Let ‘n0‘and constant ‘c’ are two
integers such that ‘n0‘ denotes some value of
input n>n0. Similarly ‘c’ is some constant such
that c>0.
f(n)<=c*g(n)
then f(n) is O(g(n)).
In other words f(n) is less than g(n) if g(n) is
multiple of some constant c.
5. Standard Method to Prove Big-Oh
• To prove that f(n) is O(g(n)):
1. Choose n0 = 1.
2. Assuming n > 1, find/derive a C such that
f(n)/g(n)≤C g(n)/g(n)= C
This shows that n > 1 implies f(n) ≤ C g(n).
Keep in mind:
• n > 1 implies 1 < n < n2 < n3 < . . .
• “Increase” numerator to “simplify” fraction.
6. Big-Omega Notation
• “Ω” represents the Big Omega notation.
• “Ω” is a method of representing the Lower
bound (minimum amount of time) of
algorithm’s running time.
7. f(n) is Ω(g(n)) ≡∃C ∃ n0 ∀n (n > n0 → f(n) ≥ C g(n))
• Let f(n) and g(n) be two non-negative
functions. Let ‘n0‘and constant ‘c’ are two
integers such that ‘n0‘ denotes some value of
input n>n0. Similarly ‘c’ is some constant such
that c>0.
f(n) ≥ c*g(n)
then f(n) is Ω(g(n)).
In other words f(n) is greater than g(n) if g(n)
is multiple of some constant c.
8. Theta Notation
• “Θ” is a method of representing the running
time between the Upper bound and Lower
bound.
9. f(n) is Θ(g(n)) ≡∃C1 ∃C2 ∃ n0 ∀n (n > n0 → C1g(n) ≤f(n) ≤ C2 g(n))
• Let f(n) and g(n) be two non-negative
functions. Let ‘n0‘ and constants ‘c1’ and ‘c2‘
are integers such that ‘n0‘ denotes some value
of input n>n0. Similarly ‘c1’ and ‘c2’ are some
constants such that ‘c1’ >0 and ‘c2’>0.
C1g(n) ≤f(n) ≤ C2 g(n)
then f(n) is Θ(g(n)).
In other words, function f(n)=Θ(g(n) iff g(n) is
both an upper and lower bound of f(n).