the probability distribution of allsix valid hands,

| August 30, 2017

Question
Consider the following card shuffling algorithm. There are three cards in the deck and they areeach represented by a number in {0, 1, 2}.

deck := [0,1,2]
for i from 0 to 2 do
j := RANDOM(i)
swap values of deck[i] and deck[j]
end for
return deck

For each of the following definitions of RANDOM(i), compute the probability distribution of allsix valid hands, [0, 1, 2], [0, 2, 1], [1, 0, 2], etc., at the end of the algorithm.

a) RANDOM(k) returns an integer chosen uniformly at random from the set {0, 1, 2}. Here, anyof the three possibilities are equally returned.

b) RANDOM(k) returns an integer chosen uniformly at random from k to 2 (inclusive). Here,values less than k are not returned.

c) RANDOM(k) returns an integer chosen uniformly at random from the set {0, 1, 2} {k}. Here,the value of k is never returned (so each swap must actually swap values).

Get a 30 % discount on an order above $ 5
Use the following coupon code:
CHRISTMAS
Order your essay today and save 30% with the discount code: CHRISTMASOrder Now
Positive SSL