private void sink(int i)
	{
		int t = pq[i]; // save for later restoring at correct position

		while (2 * i + 1 <= N) // The node has both the children
		{
			int j = 2 * i + 1; // right child

			if (greater(items[pq[j]], items[pq[j - 1]])) // determine the
															// lesser child
				j--;

			if (greater(items[pq[j]], items[t])) // Final position for
														// items[pq[i]] reached
				break;

			pq[i] = pq[j]; // half exchanges
			qp[pq[j]] = i; // adjust the reverse index
			i = j;
		}

		// if pq[i] had only one child, the comparision for sink hasn't been
		// done yet
		if (2 * i == N)
			if (greater(items[pq[i]], items[pq[N]]))
			{
				pq[i] = pq[N];
				qp[pq[N]] = i;
				i = N;
			}

		pq[i] = t; // restore in the correct position
		qp[t] = i; // adjust the reverse index accordingly
	}