Week 8: Impressions of Week 7
The focus of week 7 has been on binary trees and their nodes. This has been my favorite part of recursion so far, as I understand the structure of binary trees better, and appreciate their usefulness in binary search algorithms.
In preparation for the upcoming test, I downloaded the example BTnode.py class and practiced implementing some functions. I found that the most tricky kind of function to implement was tree_sum, which summed all of the elements of the tree. I had to implement cases for whether or not node.left and node.right were equal to None or not, because a a for loop cant be used for the children like an ordinary tree.
I feel like I'm finally starting to get my head around recursion and trees. Next on the list is linked lists.
I feel like I'm finally starting to get my head around recursion and trees. Next on the list is linked lists.
No comments:
Post a Comment