Template Function ADS::kthOfTwoSorted

Function Documentation

template<class T, class C = std::less<>>
T ADS::kthOfTwoSorted(const std::vector<T> &X, const std::vector<T> &Y, std::size_t k, C less = C())

kthOfTwoSorted(): the item of rank k, from 0, of the sorted X and Y together; O( log min( m , n ) )

Pre:

X and Y are sorted, k < m + n

Post:

the item of rank k of the merge of X and Y (an audit)