CSC148H5 Lecture Notes - Lecture 19: Quicksort, Insertion Sort, Merge Sort
Document Summary
Take right most element compare to all elements if smaller than element switch element with left most element of the partition (partition seperates sorted list from unsorted) Stuff to the left of the i are less than the pivot. Stuff from i up to but not including j is the processed elements. Rearrange lst so elements >= pivot follow elements < pivot; return index of first element >= pivot i = left j= left while j <= right: return i. Old sort selection sort at the rest of the not sorted list. Insertion sort insert it into the correct area in the unsorted list. Quick sort it to the left and more than it to the right and then runs the rest o.