Sunday, 8 February 2015

My Week 4 Recap, Including Tracing Recursion!

Week 4 was a pretty hectic week in every class because of all the assignments and the midterms that were about to happen. CSC148 was no different because of the midterm that would happen the week after and the assignment we had due on Thursday. We also learned recursion which was something we haven't really seen before in CSC108 so that was pretty interesting. Our lab was mainly focused on tracing recursive functions with the last question on  our lab focused on actually writing the function, whereas our quiz was just on tracing the recursive function.

For the assignment, it wasn't so bad that week because my group mainly planned everything out beforehand so we didn't have to rush last minute to get things done, so that made my week a bit easier. We mainly just had to fix up the little things like running it through pep8 for any white space, spacing and all that. All in all I feel we did a pretty good job, and hopefully we do well.

During lectures we looked at recursion, mainly on tracing recursive functions to see the value that would get outputted. We looked at the logic behind it which is focusing on breaking each argument into a smaller problem to try to get the recursive function. I've never really had any experience with recursion so this was something completely new to me. It's pretty interesting because its a lot more concise and elegant than iterative solutions.

Although I found that tracing the recursive function was pretty straightforward, in the lab for the last section where we had to actually write the recursive function ourselves, I found that quite difficult. It was where we had to return the maximum length of either the list or its sub lists. I kept thinking how I would manually trace it back to get each call which ended up making me very confused. I ended up just thinking about how I could break the problem into smaller problems which helped me think a bit more logically.  What I ended up doing was thinking about how if each element was a sub list I would call the function again and from there I would get the max of all those numbers to return.

At the end of the tutorial we had a quiz and I realized I made a mistake on the last question of my quiz for the last question...I guess I kind of got too rushed or panicked and ended up forgetting to check the call on the sub list of the list. I just ended up making the call for the list and totally forgot about the sub list within the list so I know I got that wrong. For the next quizzes I really have to be more careful about things like that.

So that was my week 4! Definitely getting more challenging, but definitely more interesting as the course continues on.

No comments:

Post a Comment