private void sink(double[] pq, int k, int N) {
        while (2*k <= N) {
            int j = 2*k;
            if (j < N && Helper.less(pq, j-1, j)) j++;
            if (!Helper.less(pq, k-1, j-1)) break;
            Helper.exch(pq, k-1, j-1);
            k = j;
        }
    }