Thursday, 19 February 2015

Week 6: Recursion in a tree

  This week we did more exercise on recursion. We used a tree model to understand recursion. And during this week I learned some new methods to deal with recursion problems.
 
     First, just like using a tree, we need to draw a picture to help us understand recursion, otherwise it will be too abstract for us to understand.
   
    Second, during solving the tree problems, I found that the easiest way to write a recursion function is: first, find the basic case. Then, go further, try a one-time recursion. Last, check whether this will work for more complicated data. This process simplifies writing a recursion function, thus making it easy for me to write it.

    But I also encountered some problems. Sometimes I even cannot figure the base case. For example, sometimes some problems seemed to ask us to  trace back from children tree to parent tree, but the base case cannot be when it comes to parent tree! So this case may bother me. I've handled a problem like this, but still really confused about it. I think a good way to overcome it is to practice more. Thus, I'm trying to find more exercise form lab to do.

    Another problem is not about programming itself, it's about my learning style, I found that my answer for midterm was OK, but it was not so reasonable. Writing a function which can run is not a hard thing for me but thinking like a computer scientist is really a tough thing for me. I am so worried about that and am afraid this may make me lose lots of mark on the coming test. I think the best way to overcome the problem is to ask others more. Working out a function is far more from success, I should communicate more with others to find the most reasonable way to write a function.
   

No comments:

Post a Comment