Skip to main content
1 of 2
Joel David Hamkins
  • 236.5k
  • 44
  • 777
  • 1.4k

There are numerous ways to measure the efficacy of a computational algorithm using the ideas of computational complexity. That is, you should measure the complexity of your algorithm by the intensely studied classes of P, NP, PSPACE, EXP, and so on. That is, if you have an algorithm to calculate a function f, the important thing to look at is where does your algorithm sit with respect to these complexity measures: is it polynomial time? exponential time? Is there a nondeterministic polynomial time algorithm? Is there a PSPACE algorithm?

You inquire about comparing your algorithm to a given recursive algorithm. For such a comparison, one should use the measures of complexity theory. If these two algorithms have the same computational complexity, then they are equivalent by these measures, even if your algorithm does not exactly amount to performing the same computation, and the two methods would be equivalent in terms of their computational cost. But if one algorithm finds itself in a lower complexity classification, then it will inevitably be superior in the general case.

Joel David Hamkins
  • 236.5k
  • 44
  • 777
  • 1.4k