Friday 6 December 2013

Week 13 - Exam

As requested, this blog entry is going to be on the sorting algorithms - selection sort, quick sort, merge sort, and efficiency. 

My favourite sorting algorithm is quick sort, I especially like it because it's running time doesn't increase very much as the list gets very very large. I remember in class when we did the demonstration on the different sorting algorithms with different sized cups. All the cups looked the same size from where I was sitting. I remember in class when we did a head to head comparison of  some of the common different sorting algorithsm and quick sort was significantly better than the others.

In selection sort, you look at a list for the minimum value and switch it with the value at your current position. Selection sort has an efficiency of O(n^2).
In quick sort you choose a pivot point and compare it to the values in the list, moving the smaller values left of the pivot and larger values right of the pivot. This process is repeated recursively. Quick sorts efficiency is O(nlogn)
In merge sort, you take a list and divide it in halves, sorting these smaller halves and then merging the results together. Merge sort has an efficiency of O(nlogn).

This is my last slog entry, and with this I'm done the term work portion of the course and now it's time for the exam. Gonna watch some adventure time. Peace Johnny.

Wednesday 20 November 2013

Week 11

Don't have time to do a slog entry for this week, have alot of assignments and tests, but here's a picture of a cat because that is always relevant

Wednesday 13 November 2013

Week 10 - Midterm #2

We just had our second term test, which was worth 2 times as much for me because I defered the first mid term. I'm pretty sure I failed, I was too bogged down with assignments and outside of school stuff that I barely studied. I'm sure I would have gotten 90 if I knew that we were allowed to have a cheat sheet. Ah well, Johnny.

The test had three questions on solving recursion problems involving binary trees. They weren't too difficult I just don't do programming on paper well, a lot of my problem solving process involves trial and error and using python, referencing previous similar programs and using the help function as well as googling.

It seems like there won't be any computer science assignments or labs or tests. So now I can take some time to focus on my other classes and prepare myself for the exam. I went to the registrar and was able to credit/no credit this course, because I've decided I no longer want to do a computer science minor.

I was going to do a computer science minor so I could have second teachable subject, but it seems like I didn't like computer science as much as I thought I did. It became less of a course where you translate solving a real life problem into a different language that can be understood and computed by a computer, into a tedious one where you try and learn confusing syntax and programming is no longer intuitive. Anyways, it was fun while it lasted, it's still an interesting topic just not one that I wish to delve further into.

Programming is alot like doing math over different fields - fields have members that are defined by certain properties (like the integers or real numbers) and supports different operations, for example, addition and multiplication. Just like the numbers you can use and what you can do with them is restricted based on the limitations set by this field, the same way we are limited to what we can do with computers, because they aren't capable of the complex reasoning and cognition that humans are. Thus we can only give them certain data types (such as int or str) that are recognizable by a coding language and operations that are supported by the programming language such as max, or min. Thus solving a problem with a computer is different than solving a real life problem because of the way we define the data and operations we can use with that data on a computer. Analogous to how we would solve a problem using the set of real numbers we are used to and then taking that problem and solving it over a different field of numbers.

Time to ace this exam and pass this course.

Here's some motivation for me:


Monday 4 November 2013

Week 9 - Sorting and Assignment #2

Today in class we learned about selection sort and quick sort using a demonstration involving different sized cups. I was pretty familiar with selection sort from CSC148 and high school but quick sort was a very clever way of sorting a list using recursion.

Basically, in quick sort you assign a random (in our case: the first) value of our list/sublist to be a pivot. All of the values greater than the pivot are put into a sublist on the right of the pivot and the values on the leftare put into a sublist to the left of the pivot. This is repeated recursively on the left sublist and the right sublist untill we have a fully sorted list

Assignment two is due tomorrow at midnight, due to other class work I've only been able to take a look at it today and to be honest I have no idea what the heck is going on. Hopefully, reading over the assignment further will make it more clear.

In other news, I got to visit my family in Mississauga this weekend, my Grandfather came from back home. It was nice to see them again after a couple of weeks of no contact, but their nagging remind me just why I moved out.

-Steve

Wednesday 30 October 2013

Week 8 - Big Oh Analysis

I have created a name for all followers of my slog. From here on out you wonderful readers shall be called Johnny's. So thank you Johnny, for reading my slog, you are a beautiful soul. Today we learned about runtimes of functions. Some functions have a logarithmic or linear running time, others have quadratic runtimes, or exponential or even worse factorial running times.

This is similar to math where we learn about which functions increase faster as you take the limit to infinity in order to find limits of combinations of functions. In the applied case of computer science, there are times when functions handle very large lists of values, some millions of values in length, this is where run time comes in to play. A linear function and quadratic function may have very similar running times (A quadratic function might even start off faster then a linear function) and the extra time may be inconsequential when the size of the parameters passed is small, but as the size of the parameters increases, the discrepancy between a linear and quadratic function gets larger and larger, and for very large values, this time difference is very big. Thus if two functions perform a similar task that requires handling very large values or lists, then it is important to use the function that has the smallest running time. A classic case of this are sorting algorithms.

Here's a picture of the run time of different functions mapped as the input size increases

Thanks for reading Johnny, you da best.

Friday 25 October 2013

Week 7 - Linked Lists

This week, we learned about linked lists, linked lists consist of a collection of nodes. Each node contains a reference to the next node in the list and carries a unit of data called the cargo. Linked lists are the perfect candidates for using recursion because each linked list has a reference to another linked list, and thus it is natural to call them recursively. I'm not really digging linked lists, and I dread yet another opportunity to use more recursion.

We got our tests back last class, I didn't write my test because I was sick as a mug. I think I would have done well - well I would have passed at least. Hopefully I can defer the mid term.

Linked lists remind me of a train in which each piece of cargo is connected to the next.



Choo Choo.

Didn't go to tutorial either because I had a math assignment I had to finish, not a very productive week. I plan on reviewing the lab to get a better understanding of linked lists.

- Steve signing off.