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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started