private void sink(int k) {
        //My method.
        if (false) {
            int i = k * 2;
            int length = size;
            while (i <= length) {
                if (i < length && less(i, i++)) {
                    i++;
                }
                if (less(i, i / 2)) {
                    exch(i, i / 2);
                } else {
                    break;
                }
                i *= 2;
            }
        }
        //Course's method.
        else {
            int length = size;
            while (2 * k <= length) {
                int j = 2 * k;
                if (j < length && less(j, j + 1)) {
                    j++;
                }
                if (!less(k, j)) {
                    break;
                }
                exch(k, j);
                k = j;
            }
        }
    }