Question: Using an array-based list, describe an efficient way of putting a sequence representing a deck of n cards into random order. Use the function randomInt(n),
Using an array-based list, describe an efficient way of putting a sequence representing a deck of n cards into random order. Use the function randomInt(n), which returns a random number between 0 and n − 1, inclusive. Your method should guarantee that every possible ordering is equally likely. What is the running time of your method?
Step by Step Solution
3.34 Rating (172 Votes )
There are 3 Steps involved in it
We can use a FisherYates shuffle algorithm to put a sequence representing a d... View full answer
Get step-by-step solutions from verified subject matter experts
