Can you prove that the below code produces a random permutation, where RANDOM(i, n) produces a random integer in (i, n]
RANDOMIZE-IN-PLACE(A)
n = length[A]
for i =0 ... n-1
do swap (A[i], A[RANDOM(i, n)])
Former Bush administration flack Dan Bartlett is Wal-Mart's new PR guy.
-
Former Bush administration flack Dan Bartlett is Wal-Mart's new PR guy.
Sounds about right.
Read more...
15 minutes ago