I have to say CompSci lab's are sort of saving me since they are the only time where I can actually see how to apply what I'm learning in a setting with support from someone who actually knows what they're doing as well as the helpful collaboration with my partner. I thought this week's lab was good because it forced me to think through different ways to write code in order to do the same thing.
In class we have been learning about binary search trees. These are basically the same as trees that we learned about before but with a more organized structure. There is a root with an value, to the left is all values that are less than the root and on the right is all values greater than the root. This is the same for each node in the tree.
BST's are most helpful when it comes to sorting, searching or putting the tree in-order. Since there is a set structure of where values will be, it is more efficient for these types of functions. It helps me to think that there is a yes or no question to be asked at each node, is it larger than this item? Thinking in this way makes code more understandable and easy to write. These "yes or no" questions allow virtually half of the tree to be eliminated when trying to find an item in a tree. It is clearly an important structure and powerful when used well.
I didn't understand the big-OH very well this week but my plan is to figure that out the best I can on my end. I might have some questions to pose here later if I can't do that.
Until next time...
No comments:
Post a Comment