public void sort(double[] pq) {
        int N = pq.length;
        
        // Create heap structure
        for (int k = N/2; k >= 1; k--) {
            sink(pq, k, N);
        }
        
        // Move largest item to end of unsorted section of the array
        while (N > 1) {
            Helper.exch(pq, 1-1, --N);
            sink(pq, 1, N);
        }
    }