Monday, 30 March 2015

This week we are asked to revisit an earlier slog posting and see whether we agree with earlier self, and also compare our experience with our classmates.

After revisiting a posting about recursion, I find myself agree with what I wrote about a month earlier. However, by comparing it with a posting of another classmate Ding, I can improve some of my views. Ding thought understanding the algorithm of writing recursion is of great importance, especially for complex functions. I wrote in my posting the method that I followed when creating a recursion in the earlier posting. Indeed, I used systematic way to write functions, so they were not so messy and difficult. Otherwise, even though you can deal with some functions, it is easy to get lost when you face more complicated ones. By following methods, you can track what you are doing and figure out what direction you should head.

Thursday, 12 March 2015


    LinkedList made me confused at first. The “front” of LinkedList seems to be everything you need to know about LinkedList, and if printing it, you will get a complete LinkedList. It was tempting to assume that “front” is just the LinkedList itself. But Diane gave us a great example. She said LinkedList is like the process of treasure hunt, and front is the first clue that leads to other clues.      

    Another confusion was that LinkedList is mutable. I did not pay attention to this property of LinkedList at start, so it was no surprise that I made mistakes in lab. However, drawing pictures really helped me out. In this way, writing code is more comfortable and I made fewer errors.

Sunday, 1 March 2015

    This is the first time that I learn about recursion in computer science. My first impression was that recursion seems to be like loop. You go over a process again and again. But then I realized they are actually very different. Recursion is not simply repeating a process, but going to a deeper layer at the same time.  
    The method I follow every time I write a recursion is basically what Danny taught us in class. The first step is to find the simplest situation, which seems to be easy. But you have to find a return value that is coordinate with the code you are going to write next. Then I will consider the situation where recursion appears once and figure out the code through which I get the right result. Last, checking with the situation where recursion appears twice or more times is a good idea.  

    So far we have learnt recursions in some different scenarios like tree, nested lists and so on. I get a rough idea when we should use recursions. It’s when you need to apply the same thing to many layers of an object. Peeling an onion may be a good analogy. You peel down every layer of an onion in the same way until you get the basic layer.