Saturday, March 12, 2016

Recursion, Part 3 (ft. Binary Trees) [Week 8]

This week, we were able to get some experience with implementing certain functions of binary trees. I learned that there were four ways of searching trees instead of the two general depth and breadth search. However, there were three different ways of doing depth-first search, but I find pre-order search the easiest to understand. Perhaps I'll do the pre-order search when I'm implementing the depth-function search function for my 2nd assignment. As for the other functions, I found the general cases really hard to solve. I still wasn't able to get a lot of practice with binary trees, but I did find that drawing pictures of binary trees and working out each case helped a lot when getting some binary tree practice in the labs.
Luckily, implementing recursive functions for binary trees in the labs were nothing new to me since their implementations are pretty similar to making recursive functions for nested lists. I naturally found it intuitive since the difference between the base case and the general case for binary trees seems to be whether the tree has children or not, just like checking whether an element in a list is a list or not for making functions on nested lists. I'm going to assume that the midterm questions relating to recursion are much harder than those in the labs, so it might be similar to the ones presented in lecture.
At this point in the course, there really isn't any new concept we can learn, except for seeing more applications, which I'm pretty excited about. So see you soon.

No comments:

Post a Comment