Sunday, 23 February 2014

Week #6: Trees

This week we learned about a different type of stacks. Theses were called trees. They were made into a separate class of their own and we were taught the different terminology of the Tree class. Each value was called a node. Each node could only have one parent meaning that it was only part of one Tree class and not multiple. The node at the top was known as the root and there was only one unique path from the root to each node. There were no loops.


Within the nodes there were terminologies to make nodes specific. They are as follows:

  1. Leaf - A node with no children.
  2. Internal Node - A node with one or more children. (It's possible for a node to have more than one children but not more than one parent.)
  3. Subtree - A tree formed by any tree node together with its descendants and the edges leading to them.
There were also two other terms:
  1. Height - The maximum path length in a tree. Each node is counted as a height of one. So, the maximum number of nodes from the root to the final node would be the height.
  2. Arity, Branching Factor - The maximum number of children for any node.
I have absolutely no idea how this is going to help us as of yet but I've taken a look at assignment 2 and it's based on designing a class which is similar to this. We'll see how that goes.

Also last week in the labs, we had to do some work which made us think outside the box. We had to use loop to recreate some built in python functions. The lab was pretty straightforward and not too challenging. 

We've got the midterm this week and just received an email saying that we're allowed to bring one cheat sheet with stuff written on both sides. I'm not quite sure what to write on it but I've got two days to figure it out. Anyways I hoped you enjoyed reading this and that the explanation of the Tree class was clear (to be honest, I actually was pretty lost until I wrote this. Now I've got some sort of clue to what's going on.) Until next time.

No comments:

Post a Comment