Hi everyone!
Sorry I’m a little late in posting this week’s entry. This
week we were asked to talk about last week’s class. Last week we learned about
Binary Trees, Tree Traversals, and Binary Search Trees.
Binary Tree
A binary tree is a tree with a branching factor of 2, where
one child is named left and the other child is named right.
Tree Traversal
Re-visiting nodes of a tree to perform a task at each node. There
are specific systematic ways in which we revisit the nodes. These ways are as
follows:
- In-order
- Pre-order
- Post-order
Binary Search Trees
(BSTs)
A binary tree where all the nodes to the left (i.e. in the
left sub-tree) are smaller in value than the node and all the nodes to the right
(i.e. in the right sub-tree) are larger in value than the node.
We also learned to code for special methods in the BTNode
class and learned to write the ‘contains’ method. I found week seven’s course
material a little intimidating at first. The special methods for BTNode seemed
pretty straight forward but the ‘contains’ method stumped me a little at first. However,
I reread the code multiple times and drew a couple of pictures with sample test
cases in mind that helped me work through the code systematically and helped me
understand the ‘contains’ method better.
Those are all my impressions for week seven and I will write
to you all next week.
Thank you !!