Examples for ICS 311 Topic 03


4n3 is Θ(n3):

To approach this, we start by writing out the definition of Θ with f(n) = 4n3 and g(n) = n3: Show that ∃ c1, c2, n0≥ 0 such that for all nn0,

c1n3   ≤   4n3   ≤   c2n3.

Try c1 = c2 = 4; n0 = 1:

4n3   ≤   4n3   ≤   4n3.

That was too easy! It's harder when you need to absorb a lower order term:

4n3 + 2n is Θ(n3):

Show that ∃ c1, c2, n0≥ 0 such that ∀ nn0,

c1n3   ≤   4n3 + 2n   ≤   c2n3

Try c1 = 4; c2 = 5. (I chose c1 = 4 to make the first term more like the second: certainly adding 2n will make it larger. I chose 5 since the right hand term has to grow larger.)

4n3   ≤   4n3 + 2n   ≤   5n3

Divide by n3:

4   ≤   4 + 2/n2   ≤   5

This is true for all nn0 = 2, since the term 2/n2 will always be larger than 0 (satisfying the first inequality) but less than 1 (satisfying the second inequality).

You should be able to do similar analyses.


Dan Suthers
Last modified: Mon Nov 19 18:23:20 HST 2012