2013年10月27日星期日

More about recursion and tree traversal

  The idea of recursion still somehow confuses me many of the times, I get the idea that recursion is like looping on itself but when it comes down to the thinking of base case, it still gives me a hard time. However, Recursion is really convenient that it allows me to write a relatively short code body and it is really smart. List comprehension is another hardship for me, as the ordering of the "for", "if", "else" placements are somehow confusing, different ordering of them gives different operation. They are somehow that are worth a lot of caution. It is also something smart as it provides a shorter code body as well. I've been stuck on the tree traversal for a short while, I didn't understand the last exercise's task. I ended up spending a couple hours going through lecture notes and some additional tree traversal notes. I figured out the use of preorder and inorder list thus causing everything to make sense. Tree traversal gives me a general idea that when executing a body, we want to use the shortest process and quickest time.

没有评论:

发表评论