Wednesday, April 6, 2016

Week 12

This is the last week in CSC148. During the last two weeks we mainly discussed the efficiency of the code (i.e. steps take to finish running the code), and hashing. It is interesting to know that we can calculate the height of the tree by lg2(number of nodes )+1. However, the most intriguing part of the last lecture is that we are taught about some python function outcomes we previously were unaware. For example, 

L=[[]]*3

L#->[[],[],[]]  different objects create L 3 copies

L[0].append(1)

L#->[[1],[1],[1]]


Here the L =[ [ ] ]*3 is just creating 3 copies of L and prints out [ [ ] , [ ] , [ ] ]. But when we 
append something to it, all the lists in the list will be added with the new something. 

In addition, we learned how to count the size of the function represented by O(n). For 
example, a n-times loop that contains a n-times loop will have size of O(n^2)

The hard thing I found about O(n) is when the loop runs differently. I have to get more practice
 so that I will get a better sense of it.

The final exam is close, I think it is important not to leave any unanswered questions and 
attend help center.

It have been a nice semester and I am looking forward to next year.