Documentos de Académico
Documentos de Profesional
Documentos de Cultura
lim( n / ((n+1)/2 )) = 2,
same rate of growth
(n+1)/2 = Θ(n)
- rate of growth of a linear function
Examples
Compare n2 and n2+ 6n
lim( n2 / (n2+ 6n ) )= 1
same rate of growth.
n2+6n = Θ(n2)
rate of growth of a quadratic
function
Examples
Compare log n and log n2
log n2 = Θ(log n)
logarithmic rate of
growth
Θ(n3): n3
Examples
5n3+ 4n
105n3+ 4n2 + 6n
Θ(n2): n2
5n2+ 4n + 6
n2 + 5
Θ(log n): log n
log n2
log (n + n3)
Comparing Functions
same rate of growth: g(n) = Θ(f(n))
different rate of growth:
or g(n) = ω (f(n))
g(n) grows faster than f(n),
and hence f(n) = o(g(n))
Definition: Big-O Notation
Function f(n) is O(g(n)) if there exists a constant K and
some n0 such that
f(n)
f(n) is O(g(n))
Work done
Our Algorithm
n0
Size of input
Comparing Algorithms
The O() of algorithms determined using the formal
definition of O() notation:
Establishes the worst they perform
Helps compare and see which has “better” performance
N2 N
Work done
log N
Size of input
The Big-Oh Notation
f(n) = O(g(n))
if f(n) grows with
same rate or slower than
g(n).
f(n) = Θ(g(n)) or
f(n) = o(g(n))
Example
f(n) is Ω (g(n))
Work done
K*g(n)
Lower Bound
n0 Size of input
The Big-Omega Notation
The inverse of Big-Oh is Ω
If g(n) = O(f(n)),
then f(n) = Ω (g(n))
i.e., as n∞, f(n) is upper and lower bounded by some constants times g(n).
K2*g(n)
f(n)
f(n) is Θ (g(n))
Work done
K1*g(n)
n0 Size of input
Thank You!!!