Suppose that instead of swapping element A[i] with a random element from the subarray A[i..n], we swapped it with a random element from anywhere in the array:
PERMUTE-WITH-ALL (A)
1. n length[A]
2. for i 1 to n
3. do swap A[i]↔ A[RANDOM(1,n)]
Does this code produce a uniform random premutation? Why or why not?
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.