Sunday, March 15, 2015

Impressions of Week 7 + Other SLOGS

    In week 7, we learned about Binary Trees, and Binary Search Trees. This is actually a simple concept in itself. There is a node with data, and it references up to two other nodes: left and right. These referenced nodes could also contain left and right nodes, and those could also contain left and right nodes, and so on. Here is a representation of a binary tree, which as you can see starts with a root, and then branches out into left and right nodes.


    This tree is labeled 'Full Binary Tree' because each node actually references two other nodes, except for the leaves (nodes at the very end). A tree like this could also be a binary search tree, which would have to satisfy the following properties: the data contained in each node must be comparable (like integers), the data in the left node must be less than that of its root, and the data in the right node must be greater than its root. Now, the reason this is called a binary SEARCH tree is because this data structure can be searched more efficiently than a list. If you want to find all the numbers within a certain range on a binary search tree, you don't have to visit every node because a search algorithm would know not to visit nodes that will not contain the data its looking for.

And now for the mandatory acknowledgement of other SLOGS:

http://cslogcs148.blogspot.ca/
First off, this URL is very unimaginative. I can already tell just from the URL that this is going to be very dull yet informative...

...well it is informative, I'll give it that. However, this one part bothered me: "The computer is way smarter than a1 now, you can hardly beat it :D" (in reference to the minimax strategy we implemented in a2). What kind of n00b loses to a bot? You gotta step up your game.

http://joshpinkney-csc148.blogspot.ca/
Still a boring URL, but at least it's personalized with the author's name. I particularly like the examples he uses when talking about class inheritance:

>>> horse = horse("Jim", "Black")
>>> horse.noise()
"NEEEEIIIIIIGGGGHHHHHH"

>>> cow = cow("Bob", "White with Black spots")
>>> cow.noise()
"MOOOOOOOOOOOOOOOOOOOOO"

>>> piggy = pig("Timothy", "Pink")
>>> piggy.noise()
"OINK OINK"

I think that this might be the most useful program I have ever encountered, because I always seem to forget what noise a horse makes.


No comments:

Post a Comment