Sunday, November 10, 2013
Week Nine
November 9, 2013.
TOPIC(s): [Sorting Algorithm and Analysis]
This week the class took into a look at the different types of sorting algorithms. Having learned of a couple already such as the bubble, insertion sort my interests waned into the ones I have not been familiar with - the merge and quick sort.
If I were to summarize what the new sorts were, for my own learning purposes, is that merge sort takes a given list and splits each list into consecutive halves until there is essentially one item in the list, and compares which element in list is greater. And in within each sublist the algorithm would sort itself, and continue comparing with other present sublists until finally the entire list is sorted.
Quick sort on the other hand, designates a "pivid" index to sort the list into two parts: elements found to be larger than the pivid, and elements found to be lesser in value from it. And essentially the pivid value would be inserted between the two parts. Using recursion, another rounds of quick sort is run to sort the other two sublists and then we have the final sorted list.
After writing up the code for the assignment due last Tuesday, I have come to better and fully understand recursion, even if it is a bit late. It was hard to visualize in my case, but for no matter how long the function of a recursive function is, or what variable is passes, the recursive would pass over until essentially.
As the week starts to arrive, I pace myself into finding a more and new understanding Binary Trees and Linked Lists and of revisiting myself in the nifty code tricks such as tuple unpacking learned throughout the months for the utmost testing period coming very soon.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment