Run-time Complexity – Week 12 – April 7, 2016

One of the last topics we covered in CSC148 was run-time complexity. It was pretty easy to follow given that we covered Big-O, Big-Omega, and Big-Theta proofs in CSC165 a couple weeks previous. The practical take-away from this is that it’s important to consider what class of Big-Theta your functions are in and be sure that you can’t do better before spending any time optimizing the speed per iteration. As your data set gets large, any optimizations in the speed of the code will become negligible in relation to the growth factor of the function. If at n = 1, you can improve your code so that it runs four times as fast, this won’t matter if your function is in Theta(n^2) when it could have been in Theta(n). It doesn’t matter that our one function runs faster when n < 4 since we assume small data sizes will take a negligible amount of time anyway. What really matters is when you have extremely large data sets. The exponential growth in run-time will make a huge impact, so it’s incredibly important to be conscious of run-time complexity when building your functions.

 

Untitled

 

Aaaand that’s a wrap on CSC148 until the exam. If I end up writing any other CS blogs, i’ll be sure to link to them from here.

Leave a Reply

Your email address will not be published. Required fields are marked *