Sunday 16 February 2014

Week 5

We worked on more recursion, except a bit more "advanced" stuff. I'm getting the hang of recursion again, been almost a full year since I did python. The lab was about "Python idioms", which is basically some really compact code that does a lot of stuff related to for-loops, except it is really short. In that lab, we got to convert that awesome python-idiom code into a really long (in some cases, nested) for-loop or while-loop mess and do the exact same procedure as executed by the python-idiom script. The functions we got to implement did pretty basic tasks such as dot product. The whole thing was a really great set of exercises and I think everyone enjoyed doing this lab.

Besides the lab, we learned something called "binary search" and I'm pretty sure I know what is going to come up during the next week related to "search". Lectures seemed short; I guess time flies when you're in a lecture that involves programming. Next week is going to be complex, I can already tell.

Sunday 9 February 2014

Week 4

This week we learned about recursion. Basically recursion is a way of solving problems by repeating a set of operations using results that were returned by the same function. Recursion usually has a base case and a condition that checks whether or not to repeat the function. Induction and recursion are awfully similar, I remember doing induction in MAT102 last year and it was one of the best things we learned. Recursion is the same deal as induction, so when you have a problem that can be solved with recursion, you can simplify the solution greatly and you end up with something that is easy to understand and manage, and if needed, modification is easy too.

This week's lab was on recursion and we started off with tracing some basic recursion functions written in Python. Tracing is a great way to see step-by-step how a recursive function (or pretty much any function) will work and you can even find errors that are hard to see by looking at code. The pen and pencil method of tracing really works, I was originally convinced that it was pointless, but I understand why it works so well now.

I am going to use these new techniques in my upcoming projects and see what the team comes up with next.

CSC148 is turning out to be full of impeccable knowledge.