In test, the hard part for me was a question called "visit in order". In fact I didn't hear about it before the exam and I didn't have a expression about we talked about it in class.
After the exam, I talked about traversal with my friends but they couldn't give me a clear answer too! So I searched it using google and I found the answer.
The tree pictures below represent traversal in-order,pre-order, post-order and level-order quite clearly.


In week 9, we only had one-hour lecture, and we talked about how to insert and delete elements in a binary search tree.
To be honest, the "delete" method bothered me until now.I didn't get the point about how it works.
The code for "delete" is at the end of the slog.
Firstly,why shall we write "elif not node.right" ? Can we just write "return_node == node"?
Secondly, what dose it mean by "node.data = find_max(node.left).data"?
To solve my problems, I decide to attend next week's office hour.


No comments:
Post a Comment