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

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).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!