Have to catch up

Bad weekend. Due to the unexpected death of a family member i was unable to get any work done as opposed to the things i had planned. Monday was better however as i was able to both get good work done during the morning, managed to follow the lecture on the afternoon and crunch numbers during the evening. This is required as i am still not done with the first part of the assignment, although i’m getting closer by the minute.

On the morning i kept working on having each of the functions work as intended with my specific list and mostly just removed the occasional error i had made which made a pointer point the wrong way when removing a node, resulting in another pointer being set wrong. I managed to get everything working and started looking into unit testing before lunch.

During the afternoon lecture i was able to follow the presentation better than usual, (there were pictures) we learned how assigning a texture to a plane in DirectX works and redid our cube exercise from last Friday, thankfully i managed to find my old coordinates for the triangles so i didn’t have to redo them again.

During the evening i was brought to attention that my list did not contain every specific case of removing a node from the binary search tree so i spent the evening writing up a list which would result in a tree containing all relevant constellations of nodes with or without children. I also added this list to the program.

Earlier when writing the erase function i noticed that when removing a node with children who in turn have children, only the ‘grandchildren’ between the two children matter.
For example: A node has the value 30. It has two children who have the numbers 28 and 32 respectively. In this case the original node is higher than it’s own parent. The node with the value 32 has two children which has the value 36 and 31 while the node with the value 28 has one child, 29. When the original parent node is removed 28 would normally take it’s place, however it already has a lower child. What happens then is that the original node’s value is set to that of the low child’s high child. (30 becomes 29 in this case) and the lowest child is removed. The program would have gone down further through the low child’s own lower children if it had any. The bottom node is then removed from the tree.
The point i’m trying to make here is that whether or not the 28 node has a low child is irrelevant as it does not affect the process of removing the original node.
This may seem a bit tangled of an explanation, but when having a diagram in front of you it gets a lot easier to understand. I’d draw one in paint but my leg is acting up again. Must be this cold.