This week we are
introduced to another abstract data type (ADT). Binary Trees are pretty much
the same as trees, except for that binary trees have an arity of 2. This means
that binary trees have a maximum of two branches. So then, we can name those
two branches as the left branch and the right branch. I think with these
settle, we can now introduce binary search trees, which are also binary trees
but the difference all of the values at the left branch is smaller than the
root, whereas the value at the right branch of the tree is greater than the
value at the root. So now when we want to search if a binary tree contains a
value we can just check if the value that we are looking for is greater,
smaller or equal to the value at the current node. We can keep doing this until
we are at the end of the tree or we found the value we are looking for. I
believe that is will be more efficient because that we don’t have visit all of
the nodes of a binary tree. Let say if the value we are looking for is 6 and
the value at the root is 10, then we just look into the left branch of 10 since
6 is smaller than 10 and according to the properties of a binary search tree,
all values that is smaller than the value at the root will be in the left child
of the root. So this avoids looking through all of the tree for the value, thus
speeding up the process of looking for a value.
In the lab that
week, we worked on recursive codes around binary trees and binary search trees.
During the first half of the lab, my partner and I was quite stuck on some of
the problems, we had no idea to retrieve the data from the trees. However,
nearing the end of the lab, we were able to figure out that the recursive code
to the problem and get things working.
After getting the things straight, I felt that I was prepared for the quiz.
At the end, I think I did okay on the quiz.
In addition, there
is the assignment that was due the following week. Things were looking good so
far for my group member and I as we finished up the game state and move for the
game tippy, we tested out the game and the game was functioning normally. We
plan to finish the up the rest of the assignment next week ( i.e., minimax). I
hope things goes well.
No comments:
Post a Comment