02 Asymptotes
02 Asymptotes
02 Asymptotes
Asymptotic Notation
Dr. Ashish Sharma
Math Background: Review & Beyond
1. Asymptotic notation
3. Recurrences
4. Probabilistic analysis
2
Asymptotes: Why?
How to describe an algorithm’s running time?
(or space, …)
4
Asymptotes: Why?
Standard solution: Abstract based on size of input.
5
Asymptotes: Why?
Solution: Provide a bound over these instances.
6
Asymptotes: Why?
What’s confusing about this notation?
n 3n2 14n+17
Solution: Ignore the constants 1 3 31
& low-order terms. 10 300 157
100 30,000 1,417
1000 3,000,000 14,017
10000 300,000,000 140,017
9
Lower Bounds
Sometimes can prove that we cannot compute something
without a sufficient amount of time.
10
Upper & Lower Bounds: Summary
Upper bounds:
O() < o()
Lower bounds:
() > ()
11
O-notation
For function g(n), we
define O(g(n)), big-O of
n, as the set:
O(g(n)) = {f(n) :
positive constants c and n0,
such that n n0,
we have 0 f(n) cg(n) }
12
CS
-notation
For function g(n), we define
(g(n)), big-Omega of n, as
the set:
(g(n)) = {f(n) :
positive constants c and n0,
such that n n0,
we have 0 cg(n) f(n)}
13
CS
-notation
For function g(n), we define
(g(n)), big-Theta of n, as
the set:
(g(n)) = {f(n) :
positive constants c1, c2, and n0,
such that n n0,
we have 0 c1g(n) f(n) c2g(n)}
14
CS
Relationship Between , O,
15
CS
o-notation
For a given function g(n),
the set little-o:
o(g(n)) = {f(n): c > 0, n0 > 0 such
that n n0,
we have 0 f(n) < cg(n)}.
16
CS
-notation
For a given function g(n),
the set little-omega:
17