Template Function ADS::mergeParts

Function Documentation

template<class T, class C = std::less<>>
void ADS::mergeParts(std::vector<T> &A, std::vector<T> &B, std::size_t start, std::size_t mid, std::size_t end, C less = C(), long long *inv = nullptr)

Merge() of the book: A[ start .

. mid ] and A[ mid + 1 .. end ], sorted, merged through B; the inversions met are added to inv

Pre:

start <= mid < end < n <= | B |, A[ start .. mid ] and A[ mid + 1 .. end ] sorted

Post:

A[ start .. end ] sorted