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.

No comments:

Post a Comment