Saturday 29 March 2014

SLOG #7: Week 11

Hey there and welcome back to my final SLOG for CSC148. Last time I talked about how I wasn't going to miss another SLOG, guess I was wrong. Well for this final SLOG, i'll try to put in as much as I can to make up for the missed weeks. So without any further delay...

For my last SLOG the topic is going to be 'Sorting and Efficiency'. Sorting was a topic that was touched on in CSC108, but only three methods were presented to us, as well the relative efficiency with one another were not discussed. In class, as well as in CSC165, we looked at describing the run-times of these sorting algorithms in terms of their worse cases, this case was chosen as the best cases and average cases tell us, as computer scientists nothing about any issues that may arise when testing larger and larger sample sizes.

We describe the run-time with an upper bound function, a run-time that is, after some point, always larger than the run time of the program. This kind of description is called 'big-oh'. All of the various sorting algorithms can be described using this 'big-oh' notation, for example selection sort is O(n2). Quite clearly all other sorting algorithms can be described in this way (my personal favorite is bogosort). The function used is found by looking at the number of times you run through the input of size n, from there the upper bound function is easily derived.

And that concludes the required writing of the SLOG. From this point forward, i'll be talking about my experience in this course and the SLOG writing process. In general I liked this course, it taught me a lot of ideas and ways of thinking in compsci that I hadn't thought of before. The process of writing SLOGs was fun and in many ways rewarding. Although it was a little difficult to get into writing weekly (technically my SLOG wasn't even weekly), I liked reflecting on what we did in class and it was a good exercise in writing (something I really need to get better at). All in all, it was a fun ride, all that's left is the final exam. Thanks for reading!

Tuesday 11 March 2014

SLOG #6

Hey again, and welcome back to my SLOG for CSC148. This week's SLOG (which will count for last week's) will be regarding part one of assignment two. I apologize to all my dedicated weekly readers for my late SLOG, but term tests and assignments clouded my mind enough for me to (almost) forget to write this one. Anyways, on to today's topic; assignment two.

We were tasked with constructing classes to represent regexes, regular expressions in python. Looking at it now that we've finished it, it wasn't the hardest thing to code, but we ran into some troubles. It is important to read over the assignment carefully before coding, our group forgot this cardinal rule and proceeded to write methods for string representation and string comparison. We only realized our mistake once we looked at the piazza and found that others had also made the same mistake, and we quickly rewrote our code to fit the requirements of part one.

I, for one, am glad that the deadline for the assignment was pushed back, as it gave us more time to realize our mistake. What I learned from this experience is that I need to read over assignments carefully and to thank the people at UTSC and UTM (although this does mean we have less to do for part two). Also, I should probably stop apologizing like I have for the last two SLOGs and actually put out more SLOGs. Anyways, until next time readers!

Thursday 27 February 2014

SLOG #5: Week 7

Hey there, and welcome to SLOG #5 for CSC148. Sorry for missing a week, unfortunately I couldn't think up a topics as it was reading week and we didn't exactly have class either, not an excuse, but no matter. On to this week's topic: recusion! ...again. I guess we'll just have to do something a little more special this week.

Let's start by defining recursion. Recursion is a method of solving a problem in computer science, where the solution to the problem depends on the solutions of smaller instances of the same problem. The solution to said problem is solved by applying a function to each instance of the problem, the application of which will only stop when the base case is reached. Putting it to words is a little confusing, plenty of other sites probably explain the idea more concisely, but regardless, you get what I mean (right?).

Recursion is a very interesting method of solving problems, often reducing the code required to solve the problem by several magnitudes. This semester, we learned about ternary if statements and list comprehensions, which in many cases, reduced the code to only 1 line. Memory efficiency-wise it may not be the best solution, however it does save a lot of space when writing code.
(Not to mention, you can draw some pretty awesome pictures using ancient drawing turtles)

In the last few weeks, we had to use recursion in most of our work, from labs to assignments to tests. This was all to drill in the recursive method of solving problems into our heads. I'll have to admit, it may have worked a little. Hopefully I can incorporate the recursive strategy into my code in the future and make my code a little more tidy. (And draw some wicked sweet pictures)

That'll be all for my SLOG this week. I guess the only special part of this SLOG was the length, but I guess it was special nonetheless. As always, thanks for reading. 

Sunday 16 February 2014

SLOG #4

Welcome back to my (mildly late) SLOG for CSC148. Now that assignment one's over and done with, this would be a good opportunity to talk about my experience while working through it. As such today's topic will be regarding assignment one and group programming.

As I've said last week, this assignment included elements that were not new to me as a programmer and as a result, the assignment wasn't so hard. My group was composed of three people, the other two being my friends. Those two had not come across this particular problem before, but as they are decent programmers (and generally intelligent people), they grasped the concept quickly. Working as a group was a little strange, given that I had only programmed alone throughout high school, but I had some experience from 108 (but I had only one partner back then). Programming as a group for us went quite well, we were efficient, assigning functions that were easy to write to each person to save time, and tackling larger, harder functions as a group.

All in all, it was fairly easy and fun (for the most part). The only real problem we had was finding a method of programming as a group. We are all commuters and lived generally far from each other. But, as with most other problems, we found a solution by consulting Google. This handy little website allowed us to program in real time with others over the internet. We just needed to copy + paste the code into our IDE's and run it with the other files.

Programming as a group was a pretty fun experience, in some cases it seemed a little slow, but it probably sped up the completion of the assignment as a whole. Hopefully assignment two will be similarly fun and easy to work through.

Sunday 9 February 2014

SLOG #3

Hey again, and welcome back to my SLOG for CSC148. This week's SLOG topic will be assignment 1. So as we all know, for assignment one, we need to work with a modified version of the Tower of Hanoi puzzle. As I have done some recursion in the past, I have run across this problem before, but I forgot the algorithm, until we were told in class. I was pleasantly surprised when I saw that the problem was modified to 4 stools, so it wasn't just going to be review of the years before. I enjoy having opportunities to flex my programming muscles every once in a while rather than just relying on past knowledge to trudge through assignments.

Working to find more and more efficient methods to solve the recursive problem is probably the most fun part of the assignment. I hope to see that these kind of problems come up more, later in the course.

Thursday 30 January 2014

SLOG #2

Welcome to SLOG entry #2 for CSC148. I'm glad to see that some people have visited my page and I hope to see some feedback on my SLOG (and not just because it's a requirement on the rubric). Today's topic will be, stuff that I found interesting in this week's lectures. This week, we went over various examples of recursion and traced through them. As well, we were introduced to turtle graphics, a drawing tool used in class to demonstrate graphically, recursion.

This wasn't the first time I've encountered this drawing tool, a few years ago, I participated in a computer science demonstration thing for high school students and we looked at recursion using turtle. We played around with recursive drawing for about an hour and I found it pretty fun. I'm looking forward to seeing what we'll have to come up with in the coming labs involving recursion (and hopefully turtle graphics). 

Wednesday 22 January 2014

SLog #1: Object Oriented Programming

Welcome to the first entry of my SLog, a student log for CSC148. This week's topic of discussion is Object Oriented Programming. I'll start off by defining what I believe OOP consists of. Object-oriented programming is a form of programming that focuses on abstract data types, the usage of these user-created data types and the interactions between them.

For me, OOP is not a new concept, I've learned to work using OOP in Java in high school and as a result, many of these lessons serve as a review. It was nice to see this come up after taking 108 (which, for the most part, didn't talk about OOP). Even though I have learned object-oriented programming already, it seems that it hasn't exactly become innate. (Explaining this would be much easier by telling a story, so I will.)

Today, I had my lab for 148 and we had to work with classes and, at the end, analyze the efficiency of the code and try to improve upon it. The best idea I could come up could only match the efficiency of the original code, so I figured it was impossible. Our TA however insisted that it was possible and after several minutes of arguing, he told us the answer; that we needed to think in terms of objects, rather than collections. When I thought about it, after he told us, it made perfect sense (sort of) and I was surprised that, after two years of working with Java and objects, that I didn't think to solve the problem with OOP.

Even though most of this material seems to be review, it looks like I still have a lot to learn.