2014年3月24日星期一

Week 11 - Sorting and Efficiency

Actually, the topic about several ways to sort a list and their efficiency was discussed when i was learning CSC108. These weeks' lectures and labs let me get familiar with some more advanced sorting codes. The select sort is just like the one i learnt in 108 lecture and the efficiency was quite low. The quick sort and the merge sort can work much more efficiently; for example, in a case of sorting 1000-length list, these two are 10 times faster than select sort. One thing which is a little interesting is that if you want to sort a sorted list with quick sort, you will spend long time on it. It looks weird, but after analyzing the codes, i understand that the time spend on sorting is depend on the choice of pivot; so, if you choose the first item as pivot, the program will go through the list one by one which make that weird thing happen. I feel very excited about built-in sort, because it works so fast even if the length of random list is over 1000000. However, the count sort introduced by professor can defeat built-in way, if the length keeping growing, but it is a kind of trick which can not be used in general case. I do not know how built-in sort works, but Well, that is why built-in sort is built in.

Week 10

Week 9

2014年3月4日星期二

Week 8

In lecture, we have talked about linked list and tree for several weeks. Generally, i think they have some similar parts; for example, the first parameter after self are all the value of that linked list or tree, and the following parameter is another linked list or tree. These two are quite organized ways to store data. Especially for linked list, it so convenient to mutate single linked list whatever it is hear, tail or in middle. Not like a regular list which is almost impossible to prepend some value without spending plenty of time. Because in linked list, prepend and pend are the same thing, they just take one step, not one step + shifting every original term in regular list.

2014年2月24日星期一

Week 7 - Recursion

Actually, the first time I learnt about this topic is in week3, but until now, I can say that I haven't totally understand the way to use it. It's really a hard part for me, sometimes i just know that i need to use recursive codes to solve the certain problem, but just don't know how to write. For example, i failed to finish writing codes solving 'counting 2' problem in the term test which really makes me a little bit sad :(. I think the only way to get more familiar with recursion codes is to trying more recursive problems and to actually understand the codes.

2014年2月23日星期日

Week 6

This week, i learnt about a new structure, tree. Honestly, i don't really understand why we should use this kind of nested structure which must be so annoyed when we try to understand the data it stored. The work on in-order, pre-order and post-order quite confused me at the beginning, but after the TA draw a picture and explained by steps, i can nicely know how it works and i can even try to write my on in-order functions.

2014年2月8日星期六

Week 5

This week, I spent much time on finishing the assignment with my partner, but the attack of headache made my work so tough; fortunately, I finally done this work. Things learnt in this week's lectures were very helpful when my partner and I try to deal with the recursion works in the assignment. However, find the way to solve the Tower of Hanoi problem was even much harder. We cannot start to coding until we finally find a good way to solve this problem (manual way). Although we have done the work, we failed to find the best way to solve the problem. I think we will work on this in the
next week.