index package:vector-algorithms

Determines which bucket a given element should inhabit for a particular iteration.
Sorts the elements at the two given indices using the comparison. This is essentially a compare-and-swap, although the first index is assumed to be the lower of the two.
Sorts the elements at the three given indices. The indices are assumed to be given from lowest to highest, so if 'l < m < u' then 'sort3ByIndex cmp a m l u' essentially sorts the median of three into the lowest position in the array.
Sorts the elements at the four given indices. Like the 2 and 3 element versions, this assumes that the indices are given in increasing order, so it can be used to sort medians into particular positions and so on.