Tip
Rather than memorizing the procedures, I find it more helpful to imagine myself sorting an object with my hand using a specific algorithm.
I recommend https://visualgo.net/en/sorting for visualizing sorting algorithms.
- Selection Sort: Move minimum of unsorted subarray into correct position in the sorted subarray.
- Insertion Sort: Move unsorted element into correct position in the sorted subarray.
- Merge Sort:
- Split array into small (length⇐2) subarrays.
- Sort all subarrays.
- Merge all subarrays into a sorted array.
- Quick Sort:
- Pick a pivot element.
- Make array so elements “left” of pivot is smaller than pivot, and elements “right” of pivot is larger.
- Recursively call quicksort on “left” and “right”.
- Bucket Sort: Use “buckets” - An array of lists. Assign each element in to 1 bucket, usually by its value (or function of).
- Counting Sort: Get counts for all unique elements, then sort array using the counts.