Wednesday, March 9, 2016

Week 8

This week we have finished general Tree class and started binary tree, which is a very efficient search method. For the Tree function, there were many terms that I initially got confused. i.e. Leaves, height (max number of edges), arity, depth, internal nodes. But as I worked more often on Tree functions, I found I got used to the terms and can now implement basic recursive Tree functions. The uniqueness for binary tree is that the maximum number of children for each node is 2. In addition there are four visiting order for binary tree: preorder, inorder, postorder and levelorder. Let us denote parent, left, right as p, l and r. Then the sequence for each order is respectively plr, lpr, lrp and l->r from up to bottom. After I look at the binary tree implementations, I found it very difficult comparing to the recursive functions we have seen; it has various branches which made recursion harder. But I do like the idea of recursion and feel passionate about solving all of them. Also, I am also looking forward to learn more searching methods. I hope to improve my thinking speed by accumulating experience!

No comments:

Post a Comment