Monday, March 2, 2015

Recursion

    This week on recursion, we went into something called BTNode, a binary tree.  Each node can have up to two children and you can actually apply binary method to the data that is contained inside.  If the children is bigger than the node, it is going to be at the right of the node, and if not, it is going to the left.  

    Our job was to create method that evaluate the BTNode, in other words put all the data into application and add, multiply... every data. And also there is a method for representing what is in the tree...etc.
    
    Although there are a lot of similarities in the recursive code we wrote in the previous week, however, this week's code is much more complex.  Instead of getting the job done in four or five lines of code, we need to consider more cases this time, therefore, more lines of code.

    This week's lab took me a lot more time than the last week, mainly because I thought we only need to write the function in a few lines, but after I realized that we need a lot more lines to finish each function, everything becomes clear again.  

    I cannot say that this week's recursion is confusing because it is not.  Recursion code is made a lot clearer to me than when I first got my hand on it.  It is really interesting and I am really looking forward to put it to use in the newest assignment!

No comments:

Post a Comment