PQ -- insert ( )

The insert operation must maintain


template <class Object> void BinaryHeap<Comparable>:: insert (const Comparable & x) { if ( isFull ( ) ) throw OverFlow ( ); // percolate up int hole = ++currentSize; for (; hole > 1 && x < array[ x / 2 ]; hole /= 2) array [ hole ] = array [ hole / 2 ]; array [ hole ] = x; }