Saturday, 2 November 2013

Mid-Term Review (Week of Oct.21st)

We finally got our mid-term back! Overall, I did pretty well on the mid-term, but I cannot believe I misread the first question and did max of the tuple instead of min. I only got the part (a) and (b) right in the first question. For the second question, we are supposed to write a function that join string in list (potentially nested) together. I did question 2 in the last 10 minutes of the test, so instead of writing one single function, I first wrote a helper function that flattens a nested list, then a function that joins a (normal) list together. However, I did try to do question 2 at home, without writing any helper method. Even though it took me more than 10 minutes, I am glad that it worked. For question 3, we are supposed to write two methods for a class: function_append: a function that returns a copy of the list with an item appended, and function_sort: a function that returns a copy of the list, sorted. At first, I just create a copy of the list and finished the rest of the definition. However, I noticed that the two functions are supposed to return an instance of FunctionalList. So I rewrote the code to return a FunctionalList. As for part (b), I forgot to include the empty case into the test case. Consequently, I got couple marks off on part (b). Overall, I think I did pretty well in this mid-term, but it could have been better.

As for class, this week we learned about linked structure. We used linked list to implement stack ADT and we also created a tree using a node class and a tree class. However, I still find the concept behind linked structure confusing, especially when you have to insert or delete a node from the structure. For instance, during lab, it took me a long time to figure out how write the method dequeue. It still takes me some time to think through how "self.top" and "self.last" change when a node is added or deleted from the linked structure. However, I do find diagrams really helpful when coding for linked structure. I think I will get better at linked structure once I practice more or read more examples on linked structure.


No comments:

Post a Comment