Algorithm analysis, like theorem proving, is largely an art (e.g. there are simple programs (like Collatz problem) that we do not know how to analyze). We can convert an algorithm complexity problem to a mathematical one, as answered comprehensively by Raphaelanswered comprehensively by Raphael, but then in order to express a bound on the cost of an algorithm in terms of known functions, we're left to:
- Use techniques we know from existing analyses, such as finding bounds based on recurrences we understand or sum/integrals we can compute.
- Change the algorithm to something that we know how to analyze.
- Come up with a completely new approach.