Saturday, 25 October 2014

Running time

In this week’s lectures a lot of content was covered. A lot more than how much is usually covered. I spent more time after the lecture reviewing the material covered as a result. One of the more interesting things I learned in the lecture this week was proof by cases. To prove by cases you have to split the argument into different cases, also the conclusion for each case has to be proved. An example would be, for all real numbers n2+n is even. There would be two cases. One would be where n is even and the other would be where n is odd. A surprising thing that I learned was uniqueness: If there are two natural numbers (m, n) and one of them aren’t equal to zero, there is exactly one pair of natural numbers (q, r) where m = qn + r, n > r >= 0. Another interesting concept I learned this week was running time, which is the number of steps taken by an algorithm. Running time is also independent of the hardware itself, meaning that it only depends on the algorithm. For running time, only how the number of steps grow as the size of the input grows matter. This means that 6n2 and 800n2 are no different, hence constant factors don’t matter. Also, we only care about large input sizes which means that n2+2 and n2+n are no different, only the highest term matters.

I also learned O(n2), which is called the asymptotic upper-bound. Which means that the function is growing no faster than n2. Ω(n2) was also covered. Ω(n2) is called the asymptotic lower-bound. Which means that the function is growing no slower than n2. It is also worth noting that asymptotic notation is simplification of real running time.


One thing I found pretty intuitive was that program running time varies with input. There is also a worst case where the running time is the longest for a specific length of input. There is also a best case and average case.

No comments:

Post a Comment