Lect 7 - Asymptotic Notation-2
Lect 7 - Asymptotic Notation-2
Asymptotic Notations-
2
O-notation
•2
5n2+2n+1 ≤ 8 n2
c=8 and n ≥ 1
-notation
•3
5n2+2n+1 ≥ 5 n2
c=5 and n ≥ 0
-notation
•4
5n2+2n+1 (n2)
5 n2 5n2+2n+1 8 n2
c =8, c =5, and n ≥ 1
1 2
Tight, loose UB and LB
•5
≥n
≥ log n Loose L.B
≥5 n2+n+5 (n2)
n2 ≤ n2+n+5 ≤ 10 n2 ,c1=1, c2=10, n ≥ 1
Big-O example, graphically
Note 30n+8 isn’t
less than n
anywhere (n>0). cn =
31n 30n+8
Value of function
It isn’t even
less than 31n
everywhere.
30n+8
But it is less than n
31n everywhere to O(n)
the right of n=8.
n>n0=8
Increasing n
•6
More Examples
•7
O-notation O-notation
n O(n2) n3 ∉ O(n2)
100n+5 O(n2) 0.00001n3 ∉ O(n2)
½ n (n-1) O(n2)
n4 + n + 1 ∉ O(n2).
-notation
n3 ∈ (n2)
-notation
0.1n3 (n2) 100n + 5 ∉ (n2).
½ n (n-1) (n2) n2 ∉ (n4 + n + 1)
-notation n2 ∉ O(n3)
0.3n2 - 2n (n2)
½ n(n-1) (n2)
O-notation example- Find c and n0
•8
4n O(5n),
c=1, n ≥ 0
4n O(n),
c=4, n ≥ 0
4n+3 O(n),
c=5, n ≥ 3
n O(0.001n2) ,
c=1, n ≥ 100
-notation examples-Find c and n0
•9
5n (4n),
c=1, n ≥ 0
n (4n),
c=1/4, n ≥ 0
4n+3 (n),
c=1, n ≥ 1
-notation example-Find c and n0
•10
4n (n),
c1=1, c2=4, n ≥ 1
4n+3 (n),
c1=1, c2=5, n ≥ 3
No Uniqueness
There is no unique set of values for n0 and c in proving the
asymptotic bounds
Prove that 100n + 5 = O(n2)
100n + 5 ≤ 100n + n = 101n ≤ 101n2
for all n ≥ 5
•12
Basic asymptotic efficiency classes
1 constant
log n logarithmic
n linear
n log n n-log-n
n2 quadratic
n3 cubic
2n exponential
n! factorial
Relation between O,
(g)=O(g) ⋂ (g)