Documente Academic
Documente Profesional
Documente Cultură
doubles
1 hr. 2 hrs.
n2
multiplies by 4
1 hr. 4 hrs.
n3
multiplies by 8
1 hr. 8 hrs.
log2 n
increase by
small constant
1 hr.
1 hr. +
2n
squares it
26 212
103
106
109
1012
16n
.016 sec.
16 sec.
4.4 hrs.
185 days
8n log n
.024 sec.
48 sec
20 hrs
3 yrs.
4n2
4 sec.
46 days
1,268 cent.
2n3
33 min.
634 cent.
2n
Growth Classes
of functions (asymptotically nonnegative)
defined on positive integers
Informally:
O(g(n)): fcns. which grow no faster than g(n)
Big-O
f (n) O(g(n)) iff there exist c, n0 > 0
such that
0 f (n) cg(n)
for all n n0.
Big-Omega
f (n) (g(n)) iff there exist c, n0 > 0
such that
f (n) cg(n) 0
for all n n0.
Big-Theta
(g(n)) = O(g(n)) (g(n))
(1) n2 + 2n + lg n O(n2)
Proof.
Little-o
f (n) o(g(n)) iff for every c > 0 there is
an n0 > 0 such that
0 f (n) < cg(n)
for all n n0.
Little-omega
f (n) (g(n)) iff g(n) o(f (n)).
Note:
If :
lim
f (n)
n g(n)
=0
If :
lim
f (n)
n g(n)
If :
f (n)
lim
n g(n)
=d>0
10
11
12
LHopitals Rule
If s and t are continuous and differentiable functions on the positive real numbers and if
lim t(n) =
or if
lim s(n) = 0 and
then
lim
s(n)
n t(n)
lim t(n) = 0
= lim
s0(n)
n t0(n)
13
14