next up previous
Next: Up: Previous:

Example:

Show that $n^2 - 2n = \Theta(n^2)$ and $200n^2 - 100n = \Theta(n^2)$.

$c_1 n^2 \leq n^2 - 2n \leq c_2 n^2$ $c_1 n^2 \leq 200 n^2 - 100n \leq c_2 n^2$
$c_1 \leq 1 - 2/n \leq c_2$ $c_1 \leq 200 - 100/n \leq c_2$
$c_1 \leq 1/3$, $c_2 \geq 1$ $c_1 \leq 100$, $c_2 \geq 200$
$n \geq 3$, $n \geq 1$ $n \geq 1$, $n \geq 1$
n0 = 3 n0 = 1



Because some choice for c1, c2, and n0 exists, then the functions are both $\Theta(n^2)$.



Because coefficients on the high-order term only affect constants, they are dropped from the $\Theta$ notation.



$\Theta(n^0) = \Theta(1)$ constant


next up previous
Next: Up: Previous: