Template Function ADS::insertionSortSentinel

Function Documentation

template<class T, class C = std::less<>>
void ADS::insertionSortSentinel(std::vector<T> &A, C less = C())

insertionSort() with a sentinel: the minimum first goes to A[ 0 ], with n - 1 comparisons and one swap, so that the inner loop of each insertion needs no test on the index, since it stops at A[ 0 ] at the latest

Post:

A is sorted, with the same items