I cannot believe I finished this course already, it's unbelievable how fast it went by! That's probably due to the fact that I really enjoyed 148 and I can honestly say that over the course of my first year, I learned the most in this class. Professor Heap is amazing, TA's were extremely helpful and to the point, course material was sooooo interesting, labs were extremely fun and challenging, assignments were my favourite, … So I'm glad to say that 148 has been my favourite class this year and I'm eager, excited and looking forward to what the Computer Science program has in store for me next year!
Wednesday, 2 April 2014
Sorting
Sorting was the main topic for the week. We discussed Big-Oh runtimes of several sorting algorithms such as insertion sort, selection sort, etc., you know the rest! This was nothing new as I had already learned this in CSC108 and CSC165. But what was in fact new to me is merge and quick sort. Merge sort is the only sorting algorithm that I understand properly and that makes the most sense. So the concept consists of taking a list, splitting it in half (because of base 2, which requires in any runtime case log(n) steps) and then iterating over each element in order to sort (which requires in any case n steps). From this, we understand where the log(n) x n is derived from; since merge sort splits in half then iterates over the halves, we multiply n times log(n) due to the nested loop. The hardest part of this week would have been understanding these sorting algorithms by analyzing their codes. I think it was due to the fact that when I was first introduced to insertion, selection and bubble sort, their codes weren't written in simply one or two lines so it was easier to deduce where the runtime equations came from.
Subscribe to:
Posts (Atom)