Monday, February 17, 2014

Week 7: recursion

Recursion is a Python function that may use itself in its definition. In summary, it divides the whole problem into several pieces of small sub problems. Usually, recursion function involves in calling itself. Firstly, it should have its base case, which is not recursion function. And then, a recursive function should change its state, and move into its base case. If people want to reuse the function, they can use recursion.

In class, we study the recursion through nested lists, which is finding the maximum number in lists of list, turtle recursion about color, direction, and distance in last two weeks. In addition, in this week, we are studying about binary tree about preorder, inorder, and so on.

When I started to study recursion, I found it is difficult for me to solve the problem, and I cannot know how to start. We should cut the question into several pieces, and try them step by step. And now, through exercise from lecture, I try my best to solve this kind of problem, and make a little  progress. I think that if I find the one method how to solve it, and it solve almost questions about recursion.

Wednesday, February 12, 2014

week 6

From this week, we are also studying the recursion about the binary tree which includes some lists, and some list of list. The main part of  tree is  three elements, whose first is object, root of tree, second and third parts are tree lists. In the course, we study some function about the tree to spread the list of list to get the object by recursion. the challenging part I feel is that I have no idea how to start when I read the question firstly. According to the instructor`s lecture, a formula to apply these questions is that [statement if else one statement ]other statement. After applying this formular, I feel confident to solve this kind of question.

In the tutorial of this week, the material is about the dot product about zip and recursion, and tester function. Firstly it confused me what the zip is, and second part is tester function which is how to write the unittest. From the slide, I learn that zip is first element of first list, and relevant in second, and so on. Secondly, importing unittest tester is important to study. From this tutorial, it is a kind of not difficult for us to do, compared with the last several times.
Recursion is to solve the questio with list of list to get the element in it.




Wednesday, February 5, 2014

Week5

This week, we are studying about some recursion about move of cheese in the assignment 1, and a little about local, non-local, global scope, which are new and hard to understand in a short time. 

During this lecture, I realized that I do not have enough efficient way to study 148. After I read the blog from Ziwei Fan`s slog, I found every-week reading is important for me to understand relative stuff about lecture. Today, after I read the week 3 reading, I know a lot of information about recursion, and test function.

Information about recursion, and test function is helpful for labs in week 4, and week 5. In this week lab(week 5), a lot of work about recursion, list of list, we should use [statement if condition else other statement] to solve that problem. But in that time, I just have no idea about solution of that case, and understand only stuff taught in class.