While insertion sort typically makes fewer comparisons than selection sort, it requires more writes because the inner loop can require shifting large sections of the sorted portion of the array.
proc quicksort_k(A, lo, hi) if hi - lo < K return pivot ← partition(A, lo, hi) quicksort_k(A, lo, pivot-1) quicksort_k(A, pivot + 1, hi) .