1O notation¶
Throughout this chapter and the rest of the book, we will describe the
asymptotic behavior of a function using O notation.
For two functions f(t) and g(t), we say that f(t)≤O(g(t)) if
f is asymptotically upper bounded by g. Formally, this means that
there exists some constant C>0 such that f(t)≤C⋅g(t) for
all t past some point t0.
We say f(t)<o(g(t)) if asymptotically f grows strictly slower than
g. Formally, this means that for any scalar C>0, there exists
some t0 such that f(t)≤C⋅g(t) for all t>t0.
Equivalently, we say f(t)<o(g(t)) if
limt→∞f(t)/g(t)=0.
f(t)=Θ(g(t)) means that f and g grow at the same rate
asymptotically. That is, f(t)≤O(g(t)) and g(t)≤O(f(t)).
Finally, we use f(t)≥Ω(g(t)) to mean that g(t)≤O(f(t)),
and f(t)>ω(g(t)) to mean that g(t)<o(f(t)).
We also use the notation O~(g(t)) to hide logarithmic factors.
That is, f(t)=O~(g(t)) if there exists some constant C such
that f(t)≤C⋅g(t)⋅logk(t) for some k and all t.
Occasionally, we will also use O(f(t)) (or one of the other symbols)
as shorthand to manipulate function classes. For example, we might write
O(f(t))+O(g(t))=O(f(t)+g(t)) to mean that the sum of two
functions in O(f(t)) and O(g(t)) is in O(f(t)+g(t)).
2Python¶