* @throws java.util.NoSuchElementException if priority queue is empty.
     */
    public Key delMax() {
        if (isEmpty()) { throw new NoSuchElementException("Priority queue underflow"); }
        Key max = this.pq[1];
        this.exch(1, this.N--);
        this.sink(1);
        this.pq[this.N+1] = null;     // to avoid loiterig and help with garbage collection
        if ((this.N > 0) && (this.N == (this.pq.length - 1) / 4)) { this.resize(this.pq.length / 2); }
        assert isMaxHeap();
        return max;
    }