Wednesday, 29 January 2014

Week4

    This week we started by discussing the upcoming Assignment 1.  Apparently, it's going to be pretty challenging, but, it won't be fun otherwise.  I'm probably starting this assignment soon, and will update my progress on here next week! 
    During the lectures, we dug deeper into the concept of recursion.  The key to understand this concept is to trace the function.  One layer by another, trace the function with absolute patience.  Another tip is to do the tracing by hand!  Try to write down every step of the recursion.  By practicing like this, you will certainly have a much better understanding of what is happening in recursion.  We did another very cool thing, which is drawing with turtles. Well, maybe you don't agree with me. But, at least for me, I think it's pretty interesting to see how people draw back then with these simplest tools. 

    This week I also took some time to review the final question of Lab 2.  Basically, it was about popping items from the front of a list without shifting the indices.  The answers I got are all telling me to track the indices and go through the list without actually deleting any items.  I found these answers unacceptable, because they are not doing what the question is asking for -- deleting items without shifting indices. 
    However, I also can't think of a satisfying solution to this question.  The closest I got is to replace the items in the list with some distinct values ("None" in my case) and delete these values when evaluating the list.  As expected, this approach gives me the ideal timing in testing.  But I don't think this is the legit way to solve this problem (as I'm also not deleting items at the first place).  I wonder how this problem could be solved... 

No comments:

Post a Comment