
Exercise. Show that for n = 5, it is possible to sort using 7 comparisons (tricky).
Now, if this list is sorted again by tutorial group number, a stable sort algorithm would ensure that all students in the same tutorial groups still appear in alphabetical order of their names
Def. AA sorting algorithm is in-place if it uses ≤ c log N extra memory. Ex. Insertion sort, selection sort, shellsort.
Chapter 7: Quicksort Quicksort is a divide-and-conquer sorting algorithm in which division is dynamically carried out (as opposed to static di.
Sort an array, A, of items (numbers, strings, etc.). Why sort it? To use in binary search. To compute rankings, statistics (min/max, top-10, top-100, median). .... Pros/cons, behavior . …
/* Sorts by selecting smallest element in unsorted portion of array and exchanging it with element at the beginning of the unsorted list.
Your Turn! Try running this sort, as well as in debug mode. It prints a lot, but you can sort of see the two steps— splitting and merging—occurring, just by the width of the left and right arrays …