Sunday, October 5, 2008

Recursion

One of the things i love the most, short and simple. Looking at the lectures done the past week about recursive functions and how to prove them by induction seems the same, most of the time you might need more than one base case(fibonacci numbers), some times you only need one! like the function we did in class(the sum of the fibonacci numbers).

looking past that, we also try to do recursive functions in code, i personally don't know python, and am more familiar with java and the other programming languages, but using recursion in code is pretty neat, although, not every requires recursion as it does take up quite a heap of memory space, going forward once then backwards to output the answer. Recursion quite easy and simple, define a basecase, then for the rest, just call the same function again. Good use to loop through binary trees or even directories on the computer!

We also did some unwinding, calculating the time it takes to loop through the recursive function (in quite a lazy way i must add! but hey we are lazy :-) ) doing some unwinding certainly have to be careful and not forget about adding time it took previously,

looks like term test 1 is coming up this friday, i don't think it'll be too brutal considering most of the things is about induction and the principle of well ordering, which shouldn't be too brutal, as i only had some problems with A1 #2 (although i do admit after seeing the solution for it, we were thinking too complicated....)

No comments: