Template Function ADS::maxHeapSiftUp

Function Documentation

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

maxHeapSiftUp(): A[ i ] goes up in the heap A[ 0 .

. i ], with the order less; O( log i ) time

Pre:

i < n and A[ 0 .. i - 1 ] is a max-heap (an audit)

Post:

A[ 0 .. i ] is a max-heap (an audit)