Skip to article frontmatterSkip to article content

Appendix: Background

1O notation

Throughout this chapter and the rest of the book, we will describe the asymptotic behavior of a function using OO notation.

For two functions f(t)f(t) and g(t)g(t), we say that f(t)O(g(t))f(t) \le O(g(t)) if ff is asymptotically upper bounded by gg. Formally, this means that there exists some constant C>0C > 0 such that f(t)Cg(t)f(t) \le C \cdot g(t) for all tt past some point t0t_0.

We say f(t)<o(g(t))f(t) < o(g(t)) if asymptotically ff grows strictly slower than gg. Formally, this means that for any scalar C>0C > 0, there exists some t0t_0 such that f(t)Cg(t)f(t) \le C \cdot g(t) for all t>t0t > t_0. Equivalently, we say f(t)<o(g(t))f(t) < o(g(t)) if limtf(t)/g(t)=0\lim_{t \to \infty} f(t)/g(t) = 0.

f(t)=Θ(g(t))f(t) = \Theta(g(t)) means that ff and gg grow at the same rate asymptotically. That is, f(t)O(g(t))f(t) \le O(g(t)) and g(t)O(f(t))g(t) \le O(f(t)).

Finally, we use f(t)Ω(g(t))f(t) \ge \Omega(g(t)) to mean that g(t)O(f(t))g(t) \le O(f(t)), and f(t)>ω(g(t))f(t) > \omega(g(t)) to mean that g(t)<o(f(t))g(t) < o(f(t)).

We also use the notation O~(g(t))\tilde O(g(t)) to hide logarithmic factors. That is, f(t)=O~(g(t))f(t) = \tilde O(g(t)) if there exists some constant CC such that f(t)Cg(t)logk(t)f(t) \le C \cdot g(t) \cdot \log^k(t) for some kk and all tt.

Occasionally, we will also use O(f(t))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))O(f(t)) + O(g(t)) = O(f(t) + g(t)) to mean that the sum of two functions in O(f(t))O(f(t)) and O(g(t))O(g(t)) is in O(f(t)+g(t))O(f(t) + g(t)).

2Python