//From page 318 of the textbook public class MaxPQ> { private Key[] pq; // store items at indices 1 to N private int N = 0; // number of items on priority queue public MaxPQ(int maxN) { pq = (Key[]) new Comparable[maxN + 1]; } public boolean isEmpty() { return N == 0; } public int size() { return N; } public void insert(Key x) { pq[++N] = v; swim(N); } public Key delMax() { Key max = pq[1]; // retrieve max key from top exch(1, N--); // exchange with last item pq[N+1] = null; // to avoid loiterig and help with garbage collection sink(1); // restore heap property return max; } //see pages 315-316 for implementations of below method private boolean less(int i, int j) private void exch(int i, int j) private void swim(int k) private void sink(int k) }