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.

Thursday, 26 March 2015

WEEK 7+8 - Trees and Binary Trees

I haven't been blogging much with all of my assignments and test, so starting with this post, I'm going to try to cover 4 weeks of sLOGs in one week....



For two weeks, we discussed trees. Tree are categorized as an abstract data-type as it can hold several pieces of data. Each tree has one root and the root may or may not branch into multiple nodes/children (depending on the maximum number of branches it can hold; arity/branching factor). If a node has no branches, it is considered a leaf. This explanation may seem simple enough, but it gets more complicated. Implementing methods of a tree requires a lot of recursion. It took me quite some time to trace through the codes in class to figure out what was going on.

After coming back from' reading' week (more like 'sleeping-eating-working-eating-sleeping' week), we were introduced to a new type of tree: binary tree. As you can probably tell from the term, binary trees only have a branching factor of 2. The picture above is an example of a binary tree. After tracing tons and tons of recursion with regular trees, binary trees were fairly straightforward.

Honestly, if I paid more attention in lecture, all of this content would have been easy, but all I was focusing on during this time was Assignment #2. We spent almost an entire class talking about it, particularly Minimax. I was only able to complete Minimax within 2 hours before the deadline thanks to office hours. I'm not even sure how I did on everything else. I hope for the best.

Thursday, 19 February 2015

WEEK 6 - Object-Oriented Programming (OOP) Summary

(Note: this will be my topic for Week 7)

YOU DOWN WITH O-O-P? YEAH YOU KNOW ME!

As you can probably guess from above, this week we will discuss Object-Oriented Programming. First off, what is Object-Oriented Programming? Object-Oriented Programming, or OOP, is a concept in which objects are the initial concern. We then use these objects and manipulate them to our needs. OOP has been the primary focus of this course so far.



OOP contains a multitude of concepts. Some of the concepts we covered in this course were creating classes and methods, initializing instance variables, and inheritance. All of these topics were discussed in my Week 4 entry, if you want a more detailed analysis of these topics.

Overall, these concepts were rather easy to grasp. The majority of these concepts, such as classes and methods, were explained in CSC108, so that really helped. With OOP down, I can't wait to begin the next sections of this course.

Monday, 9 February 2015

WEEK 5 - Tracing Recursion + Term Test 1

I know I'm a little late, but better late than never!

This week, we were instructed to discuss about tracing recursion from Week 4. Recursion essentially involves repeating the entire function until each element of the input is reached. If you have ever experienced recursive functions in math, that's exactly what it is - except that we view as Python instead of just mathematical symbols. I have to say, tracing recursive code was pretty simple. At first it was confusing, particularly with list nested in a list, which is nested within another list. However, after doing the examples in lecture and in lab, you start to pick up the format. It's especially helpful that we did not need to write down the function if we already figured out what it does for a certain input. For instance, if we figured out what a function did with a non-list, we would just write the output and skip all the elementary steps. This kept the solution very clean. As well, if the docstring is not given, you can also tell what the function does by simply tracing it and/or picking up the pattern. Overall, with practice, recursion becomes quite simple and actually fun! I can't wait until we learn how to write recursive functions.

Besides tracing recursive codes, we had our first term test. The test was fairly straightforward. It was much like what we had done in lecture and in our labs exercises. This made extremely happy. The test also involved tracing recursion, which also made me shriek inside. We're getting our results this week and I'm hoping that I did well. Wish me luck!