compare
function can take 1 or 2 steps,
and the numbers of loops depend on the polynomials'
terms' exponents.
while
loop is done the
number of terms times and the for loops are not done.
The count is 12N + 8, for N terms.
while
loop is done twice
the mimimum number of terms times, and a for loop is done
the difference between the numbers of terms times.
The count is 8(N+M) + 5(N-M) + 8 = 13N + 3M + 8, for
N and M terms, N > M.
If N = M, that's 16N + 8.
| 1 |
| log_{b}(N) |
| N |
| N * log_{b}(N) |
| N^{m} |
| k^{N} |
for (k=1; k <= n/2; k++) { for (j=1; j <=n*n; j++) { Do Something } }
for (k=1; k <= n/2; k++) { Do Something } for (j=1; j <=n*n; j++) { Do Something }
k = n; while (k > 1) { Do Something k = k/2; }