08.10.2016 Views

Foundations of Data Science

2dLYwbK

2dLYwbK

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

12 Appendix<br />

12.1 Asymptotic Notation<br />

We introduce the big O notation here. The motivating example is the analysis <strong>of</strong> the<br />

running time <strong>of</strong> an algorithm. The running time may be a complicated function <strong>of</strong> the<br />

input length n such as 5n 3 +25n 2 ln n−6n+22. Asymptotic analysis is concerned with the<br />

behavior as n → ∞ where the higher order term 5n 3 dominates. Further, the coefficient<br />

5 <strong>of</strong> 5n 3 is not <strong>of</strong> interest since its value varies depending on the machine model. So we<br />

say that the function is O(n 3 ). The big O notation applies to functions on the positive<br />

integers taking on positive real values.<br />

Definition 12.1 For functions f and g from the natural numbers to the positive reals,<br />

f(n) is O(g(n)) if there exists a constant c >0 such that for all n, f(n) ≤ cg(n).<br />

Thus, f(n) = 5n 3 + 25n 2 ln n − 6n + 22 is O(n 3 ). The upper bound need not be tight.<br />

Not only is f(n), O(n 3 ), it is also O(n 4 ). Note g(n) must be strictly greater than 0 for all n.<br />

To say that the function f(n) grows at least as fast as g(n), one uses a notation called<br />

omega <strong>of</strong> n. For positive real valued f and g, f(n) is Ω(g(n)) if there exists a constant<br />

c > 0 such that for all n, f(n) ≥ cg(n). If f(n) is both O(g(n)) and Ω(g(n)), then f(n) is<br />

Θ(g(n)). Theta <strong>of</strong> n is used when the two functions have the same asymptotic growth rate.<br />

Many times one wishes to bound the low order terms. To do this, a notation called<br />

f(n)<br />

little o <strong>of</strong> n is used. We say f(n) is o(g(n)) if lim = 0. Note that f(n) being<br />

n→∞ g(n)<br />

O(g(n)) means that asymptotically f(n) does not grow faster than g(n), whereas f(n)<br />

being o(g(n)) means that asymptotically f(n)/g(n) goes to zero. If f(n) = 2n + √ n, then<br />

asymptotic upper bound<br />

f(n) is O(g(n)) if for all n, f(n) ≤ cg(n) for some constant c > 0.<br />

asymptotic lower bound<br />

f(n) is Ω(g(n)) if for all n, f(n) ≥ cg(n) for some constant c > 0.<br />

≤<br />

≥<br />

asymptotic equality<br />

f(n) is Θ(g(n)) if it is both O(g(n)) and Ω(g(n)). =<br />

f(n)<br />

f(n) is o(g(n)) if lim = 0 . <<br />

n→∞ g(n)<br />

f(n)<br />

f(n) ∼ g(n) if lim = 1. =<br />

n→∞ g(n)<br />

f(n)<br />

f(n) is ω (g (n)) if lim = ∞. ><br />

n→∞ g(n)<br />

375

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!