Does anyone know of any program/script to calculate the computational complexity of code (e.g. method function) automatically?
If not, is there a good way (e.g. a design pattern, algorithm, etc) that supports it?
I'm not trying to do this in general.
In most cases, I know the input, the algorithm running it, and what constitutes a halt. I'm trying to compare 2 or more algorithms this way.
E.g.
algo #1 - 2x^2 + 10x + 5
algo #2 - 5x^2 + 1x + 3
Both algorithms are O(N^2). But algo #2 is better in the short run, while algo #1 is better in the long run.