Saturday, November 23, 2013

Week 11

This week's topic was hiding attributes, equality and reduce.  I learned a built-in function, property that introduces how to do the hiding attribute and how to build property function to make it as read-only form.
Also, I learned __eq__ function. This function is used as class method to know whether two or more objects are equivalent or not.
Reduce is used when we want to get a single value from the nested list by reducing lists from inside to outside.
In lab, I and my partner a bit changes the given code to evaluate the time analysis of the various sort functions. We figured out that the built-in sort is fastest sort function, and bubble sort is one of slowest function for many items contained in list. However, when sorted, insertion took a similar time as tried in random list. This is because when sort functions try to sort the sorted list, the time analysis is dependent on how many compare statement has been executed. Lastly, for sorted and reversed list, again the bubble sort is slowest one because the bubble sort has to compare and switch the items for number of item in list times.

No comments:

Post a Comment