Sunday, February 16, 2014

SLOG-Week Six

We covered binary tree in the lecture this week, and to be honest, I was completely lost during the lecture because I did not understand the binary tree terms well. Hopefully, I can understand them all while I write the slog about it. (http://lianglcsc148slogw14.blogspot.ca/2014/02/week-6-i-see-trees.html
thanks to this slogger, after reading the material on Tree list, I gain a better understanding what a tree list should look like.)

So, this is a binary tree from the lecture


  • Look at topmost of this binary tree, the topmost node is distinguished as the root node which is a node that has no parent. In this case, the root node is the topmost node containing value 2. 
  • The root node can have a child node or children nodes(left child node and right child node), and each of these child or children can have their own child node or children nodes. In this case, node with value 7 has left child node with value 2 and right child node with value 6.
  • These child node and children nodes have exactly one parent. In this case, node with value 7 is the parent of left child node with value 2 and right child node with value 6.
  • each node that does not have a child or children is consider a leaf node.
  • each node that has one or more children is considered an internal node. In this case, node with value 7 is an internal node, node with value 5 is also considered an internal node, etc. 
  • Arity is maximum number of children for any node. In this case, the arity of this tree is 2 since it is a binary tree.
  • The height of a tree is the maximum path in the tree. A path is where there is an edge between nodes. In this case, the height of this tree is 4, since maximum number edge between nodes is 4. 






No comments:

Post a Comment