Suppose that instead of swapping element A[i] with a random element from the subarray A[i ..n], we

Question:

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 permutation? Why or why not?
Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Business Law Text and Cases

ISBN: 978-0324655223

11th Edition

Authors: Kenneth W. Clarkson, Roger LeRoy Miller, Gaylord A. Jentz, F

Question Posted: