Monday, April 6, 2015

Last impression about this course

Looking over this course, it is different from a pure programming teaching course which focus on grammar and programming technique. Instead, it focus more on programming thinking. Most of the time, we are not learning how to write code, but how to solve, how to arrange the structure of the program. I remember there was a impressed demo. Professor Heap wanted to explain how binary tree search work. He asked all of the students to be one on the node, and each line of student represent a level in the tree. He as the root of the tree asked question to his sons which are the first lines of the student, and the first line asked next line until someone found the answer. This demo clearly explained how binary search tree works and demonstrates how efficient it is.

Another important concept I learned in this course is recursion. If we want to solve a problem, we can divide it into smaller problems and combine them together to solve a bigger problem. The easy-to-code nature of python provide a easy to understand and easy to design structure of recursion. Since we can use a list to contains the result of previous recursions, we can simply use + to combine these results. For example, we search a binary tree, we can put all the number by calling left subtree into a list, and put all the number by calling right subtree into another list. Now we have all the values in the tree in a single list and we can find the value of the tree easily. 

No comments:

Post a Comment