a.) 12 | b.) 22 | e.) 52 | f.) 102 | g.) 10002 |
1 | 4 = 2*2 | 25 = 5*5 etc. | 100 (hundred) | 1000000 (million) |
a.) 13 | b.) 23 | e.) 53 | f.) 103 | g.) 10003 |
1 | 8 = 2*2*2 | 125 = 5*5*5 etc. | 1000 (thousand) | 1000000000 (billion) |
a.) 20 | b.) 22 | c.) 28 | e.) 101 | f.) 103 | g.) 106 |
1 | 4 | 256 | 10 | 1000 | 1000000 |
a.) log21 | b.) log24 | c.) log2256 | e.) log1010 | f.) log101000 | g.) log101000000 |
0 | 2 | 8 | 1 | 3 | 6 |
a.) 10N2, N = 10 | b.) 0.1N3, N = 10 | c.) 10N2, N = 100 | d.) 0.1N3, N = 100 |
1000 = 10 * (10*10) etc. | 100 | 100000 | 100000 |
a.) 10N2 | b.) 0.1N3 | c.) Which has the larger order, a. or b. ? |
O(N2) | O(N3) | b. has the larger order because N3 is a higher power than N2. |
d.) Write down a value of N where b. exceeds a. | ||
d.) 101, or any value larger than 100 (see 5c. and 5d.) |
for (i = 0; i < n; i++) for (j = 0; j < n; j++) sum = sum + a[i]*b[j]O(N2), also called squared or quadratic. This code is O(N2) because it has two nested loops, so the execution time is proportional to
n
squared --
the body of the inner
loop is executed (up to) n
times
each time the body of the outer loop is executed.