Thursday, 19 March 2015

Impressions of Week 9: Test 2 and Binary Search Tree

This week we had our second term test for CSC148 and ......






Yep this was my reaction soon after I left the exam. Why is it that you only remember the stupid mistakes you made after you have left the room. Why can’t the brain function when we need it to? Well it is too late to stress about that now but for some reason the memories of my stupid mistakes have become fond of me and aren’t willing to leave just yet. I guess I need to take this as a lesson such that I don’t make the same mistakes again. But then again, this is a common occurrence as I also heard several other people mentioning that they realized their mistakes after too. Misery loves company and to know that you are not alone is somewhat comforting.

This week even after our test, we had a class for the evening section where we learned about the binary search trees. Here is an example of a binary search tree.



From this tree you can see that it is a special kind of binary tree where the left sub tree consists of values less than the root( x < 7) and the right sub tree consists of values greater than the root(x > 7). This characteristic of binary trees leads to increased efficiency for instance when searching a tree for a specific value. Let’s say that we want to look for the integer 15. We first see the value contained in the root, and observe that its 7. We know that 15 is greater than 7 therefore, instead of also traversing the left sub tree, we will move onto the right sub tree, because we know that values greater than the root node can be found in the right sub tree.

Now that we have come so far in the course, I see that this courses teaches us how to create more and more efficient code, which I believe will be of great help in everyone’s future endeavors. List compressions to binary search tree and I’m sure in the remaining few weeks we will definitely learn even more interesting concepts which I can’t wait to share with you guys. 

I will sign off for now but as usual will return soon. Take care everyone.

No comments:

Post a Comment