private int sink(int i)
	{

		Key t = pq[i]; // Save key for later restoring
		while (2 * i + 1 <= N) // while pq[i] has both the children
		{
			int j = 2 * i + 1; // rightmost child

			// 1st comparision: Making j point to the greatest of the two
			// children as pq[i] should sink to j
			if (less(pq[j - 1], pq[j]))
				j--;

			// 2nd comparsion. Stop sinking if pq[i] is not less than its
			// greatest child
			if (!less(t, pq[j]))
				break;

			// exch(pq, i, j);
			pq[i] = pq[j]; // half exchanges
			i = j; // Prepare 'i' for the next iteration
		}

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

		pq[i] = t; // restore
		return i;
	}