This week we had our second term test so we only had a 30
minutes lecture. So with a short lecture length, the amount of material learned
is minimal. However I still learned about how to write about insert and delete
function for Binary Tree. Insert
function is the easier function to implement out of the two, by using the
property of binary tree, setting a condition for base case and using recursion,
it can be implemented. Delete function is tougher to write as you have to
consider every situation and write an if statement for each of this situation
with recursion.
Maybe because the lecture is so short this week, we only worked
on these two functions and therefore professor Heap worked on it really slowly
by drawing diagrams and look at every situation extensively. I really enjoyed
this type of slow and methodical teaching as it makes sure the students will be
able to absorb these materials slowly and thoroughly.
I found the algorithm of the delete function for binary tree
is difficult to visualize and therefore difficult to implement. The list of
scenarios to consider for the delete function is really in depth and hence it
takes some time to visualize every single one of it. However, thanks to a slow
and methodical approach by professor Heap in teaching this function, it eased
my frustration in learning this delete function.
I am confident in the material covered this week largely thanks
there were simply not a lot of material that was covered due to the term test. The
lack of content and the slow and methodical teaching method really clicked with
me so I feel like I have a good grasp of this week’s material. However, the
delete function is not an easy function to understand and write so I am sure I
have to work on it more to fully comprehend.
I was generally proud of how I did in term test 2 as I think
I was able to implement the functions requested in the term test without much
of a hassle. Most marks of the term test come from the final two questions of
this term test and I feel like I am able to provide a correct answer for these
2 questions and I am proud of it.
As TAs were on strike this week, the tutorial was
essentially forced to cancel so I only worked on the tutorial on my own during
my spare time. I found that the tutorial’s instruction was clear and I was able
to follow it to the end. As mentioned above, we had our second term test and I
felt it went pretty good. I am confident that I got a correct answer for
question 1, 3 and 4 which required me to write recursion functions for binary
tree and linked list and understand arity for the class Tree. However question
2 is the most challenging question for me as it asked us to write the order of
a post_order search, I did not really know the answer for this question as it
was only covered briefly in the lectures.
More on delete function for binary tree, I originally had an
issue of not knowing what to do with the helper function find_max. This
frustrated me for during the lecture but then I asked professor Heap after the
class for clarification and I learned how this helper function works and how it
helped to implement the delete function.
No comments:
Post a Comment