Sunday, February 15, 2015

Week 6 - Tree and Writing Recursion

This week's lecture was pretty challenging, we learned class Tree and how to write recursion for Tree. I have some knowledge on how Tree works as I have studied class Tree last week in preparation of the midterm, but it was still challenging to write recursion for Tree. Basically the class Tree works pretty much as a list with list value inside, except the current list or so called 'node' has a value to it. Also it is possible for a node to have no 'children' or no sub-list.
Visual representation of a Tree object. (Writing Recursion Exercise)

The tutorial for this week is very hard, probably the hardest tutorial I have had so far, and this is the first time where I have not able to finish all method example on lab handout. Similar to lecture this week's lab is about writing recursion for class Tree, and it is very tricky. Methods that we were asked to write like return all the value in Tree object where it has at least one children are extremely complicated and requires a lot of thinking. The quiz in the end was also very tricky, where we were asked to write a  function that returns the maximum depth in the Tree object, and I had little confidence on the correctness of my answer.

  

No comments:

Post a Comment