Monday, 30 March 2015

slog for week 11

  WOW! BIG NEWS! The strike is finally over! I can't wait for the tutorial next week to see my lovely TA.
   This week we learnt about efficiency of sorts. We talked about bubble sort, selection sort, insertion sort and quick sort. Just a reminder, since it always happen to me that I mess these terms up, here are the illustration of these sorts.
 

 Looking directly at the illustrations may be the best way of understanding and memorizing these.
Efficiency is simply how the time to sort a list of n elements varies with n.
In the pictures for selection sort and insertion sort, it is already given the efficiencies and the way to get those.
For bubble sort, which in my opinion is the simplest one, it needs to go through every element after the starting one, so
it is just (n - 1) + (n - 2) +... + 2 + 1 which is 0.5 * n * ( n - 1), the efficiency is n ^ 2.
And for quick sort, it is a little complicated, where we have to think of whether the sort is well-balanced or not. In the well-balanced case, we divide the list log(n) times, and in the worst case, n times.
In both cases, we need to go over the whole list (except the pivot points), which is proportional to n. Thus, the efficiency is nlog(n) in the best case and n^2 in the worst.

Above is my summary of this week. Thank you and goodbye.

P.s. CAN'T WAIT FOR THE TUTORIAL!!!

Dark Fox

5 comments:

  1. really appreciate the images! it really help :)

    ReplyDelete
  2. Sorry that there wasn't a last tutorial. I was looking forward to getting back to work!
    - Your TA

    ReplyDelete
    Replies
    1. It was pretty sad, but thank you for all the help you gave me, have a nice day!

      Delete