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.

Friday, 11 October 2013

Week 5 - Binary Trees

This week, we talked about binary trees and three types of traversals: pre-order and in-order and post-order

preorder traversal: you visit the root, then pre-order left subtree, then pre-order right subtree

In order traversal: you visit in-order left subtree, then the root, then in-order right subtree

In post order traversal: You visit post-order left subtree, then post-order rightsubtree then the root

On the 16th is our mid-term it is going to be covering recursion, inheritance and exceptions. I'm going to have to go over recursion it is still very fuzzy to me; I plan on finishing up and reviewing the labs because I find those questions to be challenging. Recursions remind me of Recursive Sequences and Series from MAT137, in which a term is defined by the previous term in the Sequence.

A simple example: A(k+1) = A(k)*2 + 7

So every term is double the previous term plus 7, and you can define the parameter k to be any set of numbers you like.

In non-computer science related news, today I saw Despicable Me - I cried. Alot.
Pic related.

Such kawaii

Wednesday, 2 October 2013

Week 4 - Recursion

Today, we learned about recursion. Recursion is really confusing, but I find it helps to trace recursive code through smaller examples to understand how it works. Recursion is like inception, because you have a function being called within itself repeatedly untill a base case is reached and then it can evaluate all of the previous function calls.



Here's a witty picture because that's what all the cool kids do. This week I stalled on my squats, so I have to deload... sucks. Atleast I lift unlike the majority of the people in this school.

In other news, we talked about Assignment #1 in class today, it's the Tower of Hanoi problem except with another peg. And the rings are represented by cheeses and pegs by stools. Seems like a very interesting problem, although the starter code is very mysterious looking.