Saturday, 28 March 2015

Week 11 (a look back to recursion)

My understanding of recursion in the first few weeks was very vague. I didn't understand how exactly recursion works, because I thought recursion was a complex algorithm. From my understanding before recursion was a function that calls itself, but everything else was hard to understand. When I had to understand a recursion I needed to trace it or make an guess.

My current understanding of recursion is a function that has a base case that does not use recursion and another case that use recursion to approach the base case (recursive case). The base case is case that has no more sub-cases. For example, leaf node in a tree would be base case (since it has no children) and internal node would be the recursive case (since it has children and its children might be the base case). To make recursion work the recursive case must be getting closer to the base case, for example internal node is getting close to leaf node because eventually internal node's children will be leaf node if the tree is not infinitely big. Otherwise recursion will result in error because it's going to recurse infinitely.

Friday, 20 March 2015

Week 10

A sample solution to minimax for assignment was posted in class on Wednesday. I am glad to say the sample solution is very similar to my code, because I also found all the game states that's one move away from the current game state, and then checked the result of that game state from the opponent's perspective. What I did differently was that I used several helper functions to get the tuple of moves and their score, instead of the only using function minimax in the sample solution.

A3 is now posted. We have two options in A3; we can either continue to improve minimax by making it more efficient or we could implement a few function for game state tree. I am more prone to improve minimax because it feels more satisfying to perfect my old code.

Thursday, 12 March 2015

Week 9

We had the second term test on Wednesday this week. I would say the term test is pretty fair judging from the lectures and labs, since all the questions on the test are very similar to the lectures or lab problems that we did. However, I feel like the strike had quite a bit of impact on this test, as we did not go through the LinkedList problems we did in the lab, nor did we have anyone to ask questions during the exam. But overall, I think I did pretty well since I understood all the materials in lecture and went over all the lab solutions.

I really find piazza helpful for this course since the profs and a lot of students are diligently answering questions on the website, and there are a lot of the questions are commonly asked questions that are relevant to the tests, lectures, assignments, or just computer science in general. I would suggest the profs to advertise piazza more.

Wednesday, 4 March 2015

Week 8

This week we learned linked list. To my understanding linked list is similar to normal list without the index value of each item. To make a linked list, we must have a start and an end, with each node linked with another node, from the start to the end. One thing I don't understand is why do we use linked list. I feel like linked list is outclassed by other data structures in every perspectives; in term of searching efficiency, linked list has a efficiency of n, whereas tree has log(n);  in term of sequence and index, list would instant return a value given an index, whereas linked list needs to go through the entire list to return a value; in term of storing data with less space, I believe sets and dictionaries are more efficient. I just can't find a situation where linked list would be the ideal structure.