Saturday, March 29, 2014

Sorting and Efficiency

Different computers have different processing powers and therefore can handle certain tasks at different speeds, this makes it useless to test the efficiency of a function/program based on its runtime on a single machine. Instead, algorithm efficiency is analysed based on the variation in resource use as the size of the processed input (n) varies. The runtime is calculated in relation to the input size (n) and is simplified to the highest degree. This is expressed in Big-Oh notation "O(n)". The big-Oh notation is used as a universal measure of the efficiency of a function regardless of machine power.

There are different implementations of sorting algorithms that differ in structure, built-in-function use and runtime efficiency. Some algorithms are more efficient than others with inputs of a smaller size and vice versa. Their efficiencies are recorded in Big-Oh notation based on a variety of inputs of different size (n). 

Saturday, March 1, 2014

Coding Inception?!

Inifinite Depth Recursion
Inception! - That was my first thought when we were introduced to recursion. A function within itself, just like a dream within a dream right? And so it seems. I actually enjoyed working with recursion, it was a new interesting concept and I liked the challenge as we had to twist our minds to think of the object within itself.
Finally, after a couple of labs, I'm getting the hang of it. At first it was difficult to mentally process how and when to end the function and place a return statement, but visualizing the process on every element and sub-element was the key.


Now I'm working on A2. Usually our assignments entail coding function which are easier to test rather than classes, since they are more clear-cut and definite in terms of their requirements, process and output. Classes are pretty vauge on what they do, or at least that's what the A2 handout seems like, so now I'm trying to figure out if the implementation that I have for the Regex and RegexTree classes are what we need to hand in. I'm thankful that the second part of the assignment doesn't depend on the classes that we design!


Oh, and last Monday a random girl came and sat next to me in the 10am class, she didn't introduce herself, say good morning or even hi! She just jumped in to ask about how A2 was going then she sat there for the hour in silence drinking her Tim Horton's coffee not even taking notes in the class, and as soon as class ended she ran off! I found that peculiar but I certainly would have liked to talk to her more. To the girl that shall remain unnamed: if  you read this please say hi? :)