next up previous
Next: O(g(n)) Up: l1 Previous: Theta

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$
$n_0 = 3$ $n_0 = 1$



Because some choice for $c_1$, $c_2$, and $n_0$ 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: O(g(n)) Up: l1 Previous: Theta