Saturday, December 7, 2013

Sorting Algorithms and Efficiency

Sorting algorithms are kind of fun, especially when I took CSC108 and the lecturer showed us a youtube video of different sorting algorithms shown through folk dance. Computer scientists have a sense of humor!

In the second to last lab, we had to analyze different sorting algorithm times that showed how little changes in your code can make little or significant changes to runtimes. It was difficult for my partner and I to sometimes find these differences in the two different version of the code, however once we asked the TA for help it made more sense. Notably, I remember that for one of the sorting algorithms that the runtime was a lot quicker by using built-in Python functions in the code as opposed to explicitly writing it out. And this was also how I learned that inserting something in a list using Python built-in is done by going through the elements and shifting them down.

I tend to get confused with the different ways of sorting, and will definitely need to review the different ways as well as look over the implementation. One of the TAs mentioned that we should know some of the well-known function implementations of the sorts, but I wonder if we will need to know it for the exam. Probably.

It is also interesting to note that I am learning about runtime analysis in my other course CSC165 and it is interesting to note the significance of efficiency in computer science and that it is an important aspect in and of itself.

Friday, November 22, 2013

Post-Math of Assignment 2 and Test 2

So aggravating that the week of test two, I also had a big assignment due the day after, and of course I don't time-manage like a proper student should, but rather feel the need to sacrifice one in order to do well in the other. Since my other assignment is worth more than double the test could be weighted (which in retrospect will be 6%), I spent most of my weekend on my other assignment instead of studying for my test.

The worst part (actually no, the worst part is the fact that I slacked off, so rather the other bad thing that happened) is that the things that I did review when I was not working on my other assignment was all about sorting, and there was nothing about sorting on the test. Additionally, I feel that the test was quite straight forward and relatively similar to the the exercises and labs, but I still managed to get a mark that rivals that of someone who didn't even show up for the test. However, the better mark on Assignment 2 my partner and I received on Assignment 2 keeps me going, and at least this means I'm not completely inadequate.

As for the final exam, I think it best if I reviewed the last few exercises and labs that I didn't for the second test. Sometimes looking through examples of recursion makes sense, but I still feel that I do not fully understand it and it just keep coming back, like Danny said in lecture. This past week, I really enjoyed learning about the different ways to further manipulate python with the use of reduce.

Someone in class had asked if the "property" assignment can be considered a decorator. I don't really know what a decorator means and have never seen the "property" assignment used before. I suppose I will add that list to the things I need to look up. Additionally, the lab was about comparing the run time of different implementations of the same type of sort, which I found really interesting because it, then isn't just about the type of sort but goes delves deeper into the mechanics of what the code is actually doing.

One last thing I wanted to mention was that I found it interesting to find myself learning about the big-Oh in this course, since we are also learning about it in CSC165. I really like when this happens because it feels like I am making connections with the material I am learning from different courses.

Thursday, November 7, 2013

This week was a hectic week, with Assignment #2 due on Tuesday and a heavy duty lab. I'm still trying to familiarize myself with the concept of recursion. Over the weekend, I was trying to find someway to use lists to complete part a of the assignment, but after going to the help centre, this really nice and patient TA helped me reframe my approach to the problem. He helped me visualize the problem in a top-down way. The bigger problem was broken down into simpler cases that the function could then call upon itself recursively to solve more complex problems. Though I was really happy that it made sense to me, and that this type of approach is the way the course work has been trying to get us to wrap our head around, it meant that I spent the entire weekend trying to implement the function in a way that I ended up scrapping and having to start over. Although to be fair, the lovely thing about recursive functions is that the actual code is not incredibly long.

I was pretty happy when I got the initializer to work, although my partner tried it on the input '((0.0)|(0.1))' it kept returning a None on one of the nodes. Just one. We ended up submitting just that though, because it was one of the many examples we tried that didn't work.

Saturday, November 2, 2013

Halloween Things - OO and Re(re(recursion)cursion)cursion

So this past Thursday was Halloween, so that means tons of treats and costumes!
Amidst all the Halloween spirit in the air, computer science is continuously rolling.

As someone who has had no programming background in high school, and only CSC108 a year ago, I struggle to keep up with what feels like a class full of students who are familiar with programming in other languages such as Java or C.

Object-oriented programming was not really taught in depth a year ago, but really only touched upon briefly. It is a way of programming that allows one to create objects that have attributes and associated methods. I feel that it can be quite useful for programmers because it allows flexibility and opens up more ways to manipulate and create code. The syntax for creating classes and creating objects as instances of these classes, was a novel thing and I really needed to learn how to call upon methods and assign attributes. That is still something that I need to continue practising because it is not something I'm used to.

Recursion is a really interesting concept and definitely one that takes some getting used to. Recursion is basically a way in which you divide the problem into subproblems, and have the method call upon itself. I really enjoy recursion...when it works out. It is sometimes hard to see what the smaller problem to solve is, but when you find out what it is, it is real fun.