Now at this point we were feeling pretty confident, however now came the tougher part of implementing the method. We tried many things but no matter what we did we would either get an infinite recursion or the incorrect output. We had a lot of trouble trying to figure out the base case, we spent a good part of the week working on Minimax however we weren't able to figure it out just yet so we decided to let it go for now and come back to it a little later.
In this weeks lecture we covered Binary Expression Trees. These are trees where parent nodes are arithmetic operators (+,-,* and /) and the leaves of the trees were data values. We learned how to evaluate them as well. Using recursion, the base case is if the tree is just a leaf, in that case we would just return the value of the node. If it is a normal tree, then you visit the left node of the parent to get the first value, then you visit the parent node to get the operator and then you visit the right node.
Another concept related to Trees we covered were Binary Search Trees(BST). BST's are a tree data structure where the values of the nodes are sorted. This is where the left node of the tree has a value lower than the parent and the right node of the tree has a value greater than the parent.
Overall i found the concepts generally interesting. It showed us the many uses of Abstract Data Structures (ADT's) which i originally thought were useless. However after Danny showed us actual applications i felt it was a lot more interesting.
Overall i found the concepts generally interesting. It showed us the many uses of Abstract Data Structures (ADT's) which i originally thought were useless. However after Danny showed us actual applications i felt it was a lot more interesting.
No comments:
Post a Comment