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

Friday, 20 March 2015

slog for week 10

  This week we learnt about assertion. In the slides it is written in the form as below:
      assert <condition> , <error_string>
---> if not condition: raise AssertionError(error_string)
I understand this form but I do not really see the point of this. Is it just a simpler form of if statement? Why and where do we use it? It is disappointing that I did not find any real examples in the course material. And there was no TA in the tutorial either. When I asked my friends, the answer was not clear and I can tell that this is not just my problem.
   Besides the course, I also used computer science elsewhere, which is really cool to me. In physics, we had practicals using python and vpython, to make the diagram and animation of waves. And for linear algebra, my friend and I tried to create classes of matrix, vector and vector spaces. And we even tried to write codes so that it will solve the polynomials we input. I have been focusing on learning how to use Sqlite these days. I think I am slowly falling in love with computer science. This is a great change of mind, since I used to hate it somehow. Now, the feeling that I can actually command the computer to do what I want in a much easier way than doing by hands is of great satisfaction. I hope I can learn more about coding, and use it more. 

   May the passion be always with me. And I will try to figure out the assertion of course.

  Thanks for listening to me.
  
  Tschuss!

  Dark Fox

Thursday, 5 March 2015

slog for week 9

   This week we learnt about linked lists, which we can think of in two ways.

1. as lists made up of an item (value) and a sub-list (rest)
2. as objects (nodes) with a value and a reference to other similar objects
   Then we started to implement the methods. At first, this process is kind of difficult since it is easy to lose track of what I was doing and what I should do next. I have to set an example for myself, and keeping turning to it. Then the professor told us to draw pictures while writing the code. That really helped. When using this method, I would not lose track as much and would not forget anything that I should do.
   It is so sad that we did not have practical this week. Computer science practicals are always the ones I love the best; the TA is really helpful and patient. I learnt a lot from the practicals past few weeks. Practice makes perfect, even if it will not make perfect, at least it can help you on the way to perfection. To get some practice, I went to the lab as usual, even though the TA was not there. I worked out several problems with the help of my friends, and had a better understanding of the topic. From merely imitating the code given by the professor to thinking independently, I learnt a lot.
For example, linked list can not be copied, I figured that out when I was trying to copy a linked list and it raised an error.
   Still have some  problems left undone. Thanks to my friends who have helped me a lot on the practical problems. I am going to work harder on it, and I will have my second term test next week.

Good luck to me and to everybody

Ciao
DarkFox