Thursday, November 28, 2013

Week #10

YAY FALL BREAK. Only two days off...then test on Wednesday. I'm so glad we get to bring a cheat sheet to the test. Writing one helps me study too. Remember to always have the base case in recursion! (ex. what will happen for an empty tree) The first element in preorder is the root of the tree. The last element in postorder is the root. The first element in inorder is the most left element in the tree. It helps to draw the basic tree of what the question is asking. Cargo can be any type but the left and right should be tree nodes when you're building a tree. At first I didn't understand that and just gave values to left and right. But even if the tree is very simple with only 3 elements, you should make left and right tree nodes with None as their left and right. I hope I do well on the test...

No comments:

Post a Comment