Data Structures and Algorithms: Asymptotic Notations
Data Structures and Algorithms: Asymptotic Notations
Asymptotic Notations
7n+5 = O(n)
for c=8 and n0 =5
7n+5 ≤ 8n n>5 = n0
7n+5 = O(n2)
for c=7 and n0=2
7n+5 ≤ 7n2 n≥n0
7n2+3n = O(n) ?
T(N) = O(N4)
T(N) = O(N3)
T(N) = θ(N2) best
T(N) = 3N2
T(N) = o(N4)
T(N) = o(N3)
T(N) = θ(N2)
• T(N) = O(2N2)
correct but bad style
T(N) = O(N2)
drop the constants
• T(N) = O(N2+N)
correct but bad style
T(N) = O(N2)
ignore low order terms
f(N )
lim =0 ⇒ f ( N ) = o( g ( N ))
N →∞ g ( N )
=c≠0 ⇒ f ( N ) = θ ( g ( N ))
=∞ ⇒ g ( N ) = o( f ( N ))
= oscilate ⇒ there is no relation
N logN = o(N1.5)