Sunday, 16 March 2014

Week #9: Run-Time Analysis

So this week was a pretty straight-forward week. We were talking about run time for a program. The different speeds that a program can run at. We learned a few different types of run time. They are as follows:

1. Constant - The amount of code executed is the same no matter what.
2. Logarithmic - The amount of code executed grow logarithmically depending on the input.
3. Linear -  The amount of code executed grows linearly.
4. Quadratic - The amount of code executed grows quadratically.
5. Cubic - The amount of code executed grows cubicly.
6. Exponential - The amount of code executed grows exponentially.
7. Horrible - The amount of code executed grows at a greater rate then the ones mentioned.
You can see how the difference in input makes the run time grow for the different code 

The order of the different run times written above are in order from lowest to highest. It's obvious that the more code that is executed, the longer the run time will be. And for all the codes, a very small input will not make much of a difference in the run times. But, if you're calculating something which takes more input then the difference could be significantly large!

Depending on how the run time grows, we will say that the run time grows O(insert run time growth pattern here) behavior. We wouldn't say O(Constant) behavior but would mention the constant value or the linear value. For example O(1) or O(n). Anyways other than that, the class this week was pretty straightforward. Until next time.

No comments:

Post a Comment