Sunday, 29 March 2015
Week 11: Looking back at previous SLOGs
As I approach the end of the semester, everything in the course is starting to fall together. In week 6 and 7 I was being introduced to recursion on trees, and at the time I would play with the implementation until my code was correct. I wouldn't fully understand why the recursion worked, I would just trust that the function would take care of all the underlining work. However, with more practice on implementing trees in my labs after week 7 and my assignments, I began to thoroughly trace each function in parts first before I put them in list comprehensions. This tracing helped me have a better grasp on what the function is trying to do and which traversal it uses when visiting each root. This week especially has helped me understand recursion as more than calling the function as a list comprehension, as what I tried to emulate when I talked about recursion in my "Week 7 Impressions" blog. By discussing with friends some hints to some of the functions' recursion algorithms for assignment 3, I used helper functions that would trace the main function step by step, which was then added to a set. A3 gave me more experience in writing recursion as separate steps, compared to my class or lab list comprehension examples. While list comprehensions are useful and efficient, it becomes difficult to trace and write on the spot (in my case as a computer science beginner). So from now on, instead of jumping straight to list comprehensions, I will write my code in parts first so that I can understand the recursion, and then try to right the code in a list comprehension if the implementation is easy enough. And when I get comfortable enough with recursion, then I will implement with a list comprehension on the first try.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment