private int partition(final int p, final int r) {
		final int x = values[p];
		int i = p - 1;
		int j = r + 1;

		while (true) {
			do {
				j--;
			} while (values[j] > x);

			do {
				i++;
			} while (values[i] < x);

			if (i < j) {
				final int v = values[i];
				values[i] = values[j];
				values[j] = v;

				final Label t = targets[i];
				targets[i] = targets[j];
				targets[j] = t;
			} else {
				return j;
			}
		}
	}