Template Function ADS::pancakeSort

Function Documentation

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

the pancake sort; the number of flips, none on a sorted vector, also with equal items (the last of the maxima goes to the end)

Post:

A is sorted, with the same items (an audit), and the flips are at most max( 0 , 2 n - 3 )