Prove that, after the following pseudocode terminates, a[h]= val: for all p, i ≤ p < h, a[p] < val; and for all p, h < p ≤ j, a[p] ≥ val. In particular, val is in the position in the array a[i],.......... a[j] where it would be if the array were sorted.
Val = a[i]
h = i
for k = i + 1 to j
if (a[k] < val) {
h = h + 1
swap(a[h], a[k])
}
swap(a[i], a[h])
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.