Wednesday 2 April 2014

Week 11: Sorting and Efficiency

We've learned many different types of sorts such as selection, merge, quick etc. Each sort is efficient for different types of data structures. For example, insertion sort is extremely efficient for data structures which are already sorted in ascending order, but terribly inefficient for data which is sorted in descending order. We've also learned about time complexity which is usually expressed using big O notation which excludes coefficients and lower order terms. For example, if the time required by an algorithm on all inputs of size n is at most 5n3+3n, the time complexity would be express as O(n^3). Time complexity is usually estimated by counting the number of steps which is taken by the algorithm.

Weel 7: Recursion

Recursion is a method in computer science in which a function calls itself in order to solve a problem. This contrasts the method which we have most often used to far which is iteration. While iteration does steps over a certain amount of time, recursion will keep calling the function itself until it hits the "base case". Although it's a somewhat complicated, recursion appears to be extremely useful as it can write some iterative codes in much less lines or in some cases, there are problems in which only recursion can solve.

Wednesday 22 January 2014

Object Oriented Programming

First few weeks in CSC148 has been pretty smooth, there hasn't been much new material so far. The assignments have been fairly straight forward with the only difficulty being getting used to the new docstring. The idea of object oriented programming is familiar to me as Java, a language I've had a little experience with, is an object orientated language. Hopefully the professors remain benevolent and do not assign us a painful first assignment.