In the week six, we begin to learn a recursive structure: Tree. The professor first told us some terminology of trees. Like nodes, root, path, leaf, internal node, subtree, height, arity, branching, factor. Trees are made up of nodes. A common kind of tree is a binary tree, in which each node contains a reference to two other nodes. The nodes is possible None. Then the professor show us a picture of a tree. And let us to complete three methods about three kinds of order of tree. All of these three function need to use recursion. Before the professor giving the solution, I have some confuse about the tree structure and not sure how can we express tree in python. After I solve the function of pre-order, I think I have a deep understand of the tree. Also, professor teach us some function like height, leaf_count. This is very helpful for us to practice the recursion and learn binary tree.
In this week's lab,we learn some python idioms and develop some unit testing skills. what I have to do in the lab is to re-implement some functions written using comprehensions and filter to use loops instead, and verify that I have consistent implementations using unit tests. I think this week 's lab is very easy and I have no trouble for this.
These are very useful data structure and I believe we will learn that in depth when doing csc265
回复删除