<1> Time analysis:
<2> Big-O notation: the order of algorithm.
if p=1 the algorithm is called linear.
if p=2 the algorithm is called quadratic.
count | 2n | 4n |
n | 2n | 4n |
n2 | 4n2 | 16n2 |
log n | log n + log 2 | log n + log16 |
Remark:
n | O(n) / 3n | O(n2) / n2+2n | O(log n) / log n + 1 |
10 | 30 | 120 | 2 |
1000 | 300 | 10200 | 3 |
10000 | 3000 | 1002000 | 4 |
for ( i = 0 ; i < n ; i++ ) j = j + 1 ;
worst case | |
Count the number of operations in | average case |
bestt case |