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.