Tuesday 5 November 2013

Catch the Code

After learning about Big-O and the run time of code, I decided to go back and try to "catch" all my old code. That is, I went back all the way to exercise 1 to see if the code I wrote could be caught and beat in run time by a more efficient method. After adjusting some of my exercises to improve their run time it became apparent to me that I hadn't really given a second thought about the run time before I learned about it. After this little practice with efficient coding, I must say it felt to to see my programs cleaned up.

But what about the other end?

I felt curious to see just how bad I could make the run time of a program become. After trying a few times, I found that to hit a run time of O(n!) was actually pretty hard. Who knew that ruining the run time of a program could be harder than to do it the most efficient way?

No comments:

Post a Comment