Friday, 3 April 2015

WEEK 12 - Final Impressions

Well, that's a wrap! This course has really been fascinating - from all of the topics discussed in lectures and labs, to all the assignments and term tests. The transition from CSC108 to CSC148 was quite drastic. Tons of information is presented right from the very beginning. In the first week of CSC108, we discussed integers, strings, and floats, whereas in CSC148 we started off talking about object-oriented programming.

This course provided many obstacles to overcome. The most challenging obstacle - and I think I can say this for everyone - were the assignments. I would spend countless hours on one method/function, and when I think it works, it fails or it causes another function to fail. Probably the most difficult assignment was the second assignment, particularly implementing the Minimax strategy. I didn't fully understand how Minimax worked until the day it was due, and I only finished it with a couple of hours to spare. As hard as the assignments were, they were also fun. The fact that we were able to create games and actually play them made the assignments much more entertaining.

Besides the assignments, learning about recursion was interesting. The idea of a function calling on itself in order to return a single value is pretty cool. This topic was then interwoven into tree, which was another interesting section. I had never guessed that date could be stored in trees.

In the end, this was a fantastic course taught by fantastic professors. I highly recommend this course to those who have no knowledge about computer science because you learn a lot of  great things hat may be useful later on in life. This has been a semester and now on to the final exam! Best wishes to everyone!

Thursday, 2 April 2015

WEEK 11 - Revisitation

Compared to my original thoughts on Week 7/8 post, I think my views on trees and binary trees have changed for the better. I originally thought that tracing and implementing recursive code was difficult. However, after doing Assignment #2 and working on Assignment #3, it is becoming easier to work with a tree. All of the practice that I have gained since learning about trees has given me a better understanding of how to work around problem and implement a proper solution. Similar to Nadine's post, I also now realize that linked lists are not that difficult to deal with. The professors' suggestion of drawing diagrams of the linked lists really does help. The diagrams helped me understand what the function was meant to do, as well as what node had to be looked at/mutated. Like with trees, all the lab exercises provided a lot of practice and insight on how to approach linked lists.

Wednesday, 1 April 2015

WEEK 10 - Binary Search Trees + Term Test 2

This week we discussed binary search trees. These are essentially binary tree that sort values into their respective spaces and used to increase search efficiency. All values less than the root are placed on the left most node, while values greater than the root are placed on the right most node.


The code used was almost identical with the code we used with a binary tree, expect that we implemented different functions (such as insert) that incorporated the property of a binary search tree. When coming up with the algorithm and writing the code, it was actually pretty easy to follow the steps and to trace it. Having knowledge about ordinary binary trees and traversing a tree, I was able to quickly understand the implementation.

Besides binary search trees, this week we also had our second term test. Overall, the test was......fair. It was a little more difficult than I expected, but it was not too difficult to think of a solution. I'm just hoping I passed and did decent. Wish me luck!

WEEK 9 - Linked Lists

This week we talked about linked lists and mutation. A linked list is somewhat like a tree, except that each node has a branching factor of 1, almost like a tree with a single branch. With these special type of lists, we explored a property that ordinary lists possess - mutability. Mutability refers to the ability to change a value. Elements of a lists can be mutated, but strings, for example, cannot be mutated.

(Note: Instead of 'head' we simply called it 'front', and the last node was called 'back'.)

When we began to implement methods, things became a little complicated. We first created a class called LLNode, which represented each node of a linked list. Each LLNode had attributes of the current value and the next value. We then created a LinkedList class, which had the methods of mutation. The algorithm and tracing of these methods was pretty difficult. The professor suggested that we draw pictures of the linked list to visualize the mutation occurring. This really helped me understand what each method was doing. Also, each method did not involve recursion, which is what we have been using with our tree methods. Instead, we were simply iterating over the linked list, much like we do with an ordinary list.