0

I'm completely new when it comes to computational theory, and I've been asked to describe what the computational cost (as a function of n) is for a python function. I'm a bit confused on how to do this.

Am I to plug in different inputs and then calculate the difference between the run time of the algorithms? And if I did that how would I describe it as a function of n?

Sorry if this is a very beginner level question, I'm very new to this topic and I'd love some further explanation as well as some guidance on how to apply it to a real function using python.

annatn998
  • 75
  • 8

1 Answers1

0

As others have mentioned, you'll want to read up on Big O Notation as that is the accepted way to mathematically express the complexity of an algorithm as a function of n. That being said, in general an algorithm's complexity is not language specific so long as those languages have the same capabilities so don't worry about it being Python too much. Also, keep in mind that time and spatial complexity are not the same thing so analyzing a program's runtime and memory usage can have drastically different results.

bpiekars
  • 53
  • 5