Template Function ADS::minimumSwapSort

Function Documentation

template<class T, class W = T>
std::pair<std::size_t, W> ADS::minimumSwapSort(const std::vector<T> &A)

minimumSwapSort(): the fewest swaps that sort A, and the least total cost of the swaps that sort it, a swap costing the sum of its two items, computed in the type W; O( n log n )

Pre:

the items of A are distinct (an audit)