Thursday, 26 March 2015

WEEK 7+8 - Trees and Binary Trees

I haven't been blogging much with all of my assignments and test, so starting with this post, I'm going to try to cover 4 weeks of sLOGs in one week....



For two weeks, we discussed trees. Tree are categorized as an abstract data-type as it can hold several pieces of data. Each tree has one root and the root may or may not branch into multiple nodes/children (depending on the maximum number of branches it can hold; arity/branching factor). If a node has no branches, it is considered a leaf. This explanation may seem simple enough, but it gets more complicated. Implementing methods of a tree requires a lot of recursion. It took me quite some time to trace through the codes in class to figure out what was going on.

After coming back from' reading' week (more like 'sleeping-eating-working-eating-sleeping' week), we were introduced to a new type of tree: binary tree. As you can probably tell from the term, binary trees only have a branching factor of 2. The picture above is an example of a binary tree. After tracing tons and tons of recursion with regular trees, binary trees were fairly straightforward.

Honestly, if I paid more attention in lecture, all of this content would have been easy, but all I was focusing on during this time was Assignment #2. We spent almost an entire class talking about it, particularly Minimax. I was only able to complete Minimax within 2 hours before the deadline thanks to office hours. I'm not even sure how I did on everything else. I hope for the best.

No comments:

Post a Comment