Sunday, March 22, 2015

Chopping down a Tree with tests

This week we looked at a function that could delete a node from a binary tree. It turns out, a lot more complicated than what I had initially imagined. There are many considerations that have to go into your code for it to not break the tree, such as checking for any children that are attached to the node. The condition that I was confused about is that once you chop off a node, you have to reattach the children to the tree. It would seem like by the way binary trees work, any nodes that are deleted, unless they are leaves, tend to force the the tree into a particular shape, mainly left sided. 

As well, the idea of floating data, such as when we delete a node, what happens to that data? It is an interesting concept since not many people know what happens to data that has been deleted, and the idea of floating data can raise the question of, if we repeat a task multiple times that results in floating data, does that affect how the program runs?

Lastly, we had our second test. Overall, the test was fair and I believed I did well, except with less confidence as the first test considering the strike has made it harder to keep up with the topics, with the lack of labs. There was one question that was a modification of a function that we learnt in lecture that was about linked lists and I'm uncertain of the coding for that question. I'm also unsure if I ended up reassigning the back or not in my code. Again, I believe that I did well although unsure of that belief. Hopefully the strike will end soon so I will know for sure. 

No comments:

Post a Comment