Sunday, February 8, 2015

To understand recursion, you must understand recursion.

Recursion has so far been fairly understandable. The whole concept of constantly recalling the same method on every element of a list is not something that is 'that' hard to grasp on, what can get confusing is when the information we are trying to get is either non-accumulative in terms of the elements of the list or requires comparing different elements of the list. For example, during the tutorial, the question asked us to write a method that would compare the lengths of each list and inner list and return the longest list. I had a hard time figuring out how to retrieve the lens of the strings without overwriting the number in the next iteration. I think I still have a ways to go. 

On a side note, this week's midterm went pretty well. I felt like I did pretty well, while the only problem I had was remembering what the type contract was when in __eq__, what to assign to 'other'. As for the length of the midterm itself, it took quite a while, mostly because I spent a lot of time rewriting the name of classes when called but i wouldn't consider it too long. Others said they were pressed for time. 

As for this week, we did more ADT in tutorial. It didn't take long to understand even though we only had a fraction of a lecture to do it. Interestingly enough, queues are basically recursion. What I did question was that once you got to an inner list, and was told to break apart that list and re-add the elements of said list back into the queue, the definition of the puts those elements at the back of the queue, rather than at the front. Is this correct or do we need to change it so that it re-adds at the front? 

No comments:

Post a Comment