Sorting algorithms: quick, merge, heap, counting sort
Data Structures · Engineering
Study notes
Quicksort [8, 3, 5]: pick pivot 5, partition into [3] and [8], recurse. Sorted: [3, 5, 8]. On sorted input [1,2,3,4,5] with first-element pivot, partitions are empty and [2..5], degrading to O(n2); random pivots fix this in practice.