Complexity Analysis, continued
To avoid hardware/software dependencies:
- Count abstract steps or values, not seconds or bytes. E.g., # of additions and multiplications rather than seconds.
To avoid dependence on specific data:
- Consider worst possible data,
- Or best possible data,
- Or average complexity over all possible data.
To avoid dependence on size of data:
- Let n be the size of the problem.
- Indicate complexity by some analytical function of n. E.g., steps needed to sort n integers is 7 * n2 + 23.
Weakness:
- Writing an exact function is too hard due to irregularities in code. Also, exact coefficients are not so important.