2014年2月23日星期日

Week 6 SLOG

Hi, everyone!

We had two lectures about how to represent binary trees in Python. Since I am taking csc240 now and we just covered this topic, it should not too challenging to me. I think the nicest about binary trees is that it is a great example for doing recursion since a parent tree can have two children and then keep continuing. If we know something about its subtrees, let's say leaves, then we know the number of leaves of the whole binary trees.

The prof covered three examples of how to order binary trees (preorder, inorder postorder). All of three functions involve recursion, and I find it really helpful to run the recursive functions in Python visualizer. It can help you understand recursion better.

Also, the prof talked about Tree class, the most interesting of this class is basically all of its method involve recursion. So when the prof wrote the method, I experienced a hard to follow him. But I did review all the methods at home and had a better picture of this class. Besides, I learnt some new build-in function of Python. For example, any function can return True if one of the element in for loop is true. And filter function is a good idea to combine another function result and a for loop to produce a list.

Anyway, term test is coming and next week is reading week. Hope it would not be an actual 'reading' week.

2014年2月9日星期日

Week5 SLOG

It is week 5 now. The most important topic this week, I think, is recursion according to the A1 and lab. But we are required to talk about recursion on week7. So, I want to write something specific about A1.

I suppose most people have started A1. Frankly speaking, the assignment in csc148 is really quite different from that in 108. A1 is way more complicated and requires much more work. It involves class, recursion and basically everything we have learnt in 108. So, it is a decent opportunity for us to test whether we can apply what we have learnt for programming in Python. Besides, we can review some new concepts just learnt, like recursion in this assignment, which it is hard to finish but excited to think how to write it.

I think the most tricky part in this assignment is the Tour part. At the beginning, we could not figure out a clue. I think the most difficult part here is we were not sure how many extra functions we were supposed to write. Actually, we came across the some problem when doing step 2. Sometimes it is hard to start because you are uncertain whether your thought in mind is correct. And a good start or more precisely, a good try could be a half success.

Luckily, prof gave us a clue about three stools version during lecture. It inspired us that 4 stools version was basically the same recursion with a slight change. The recursion of 4 stools should be formed by 3 parts, one of which should be 3 stools recursion and the other two should be moving n-i cheeses. So we need to write a 3 stools recursion which was covered in lecture as a helper function.

We have not finished A1 yet, but I believe we will finish all the steps soon and I am sure I will learn many new things from my partners.

Well, the midterm is approaching and it seems we lack enough past tests. There is only past test on the main page.