Wednesday, March 23, 2016

Week 10

In this week's lecture we learned how to implement the delete node method for binary. In delete node we need to check the number of children the node has in order to proceed. If it has no children, we can simply make it None. If it have one child, we can connect its child to its parent. If it has two children, then we need to construct the connection such that left lower than middle lower than right is always achieved. In addition, we have acquired the idea of running time. For example x to the power of 5 is much faster than x to the power of 3. More importantly, we learned various sorting methods (though the default python one is the best).  For example, in quicksort ascending order, we choose the pivot and put the greater values to its right and lesser values to its left and in each left and right part, we do the same thing again until the last single value is reached. The most inefficient method is likely bubblesort because it checks the value with the next value and swaps them if the current value is smaller; it's a disaster if the list is in descending order. I found learning different methods of sorting very fascinating.

No comments:

Post a Comment