Question: Describe an efficient way of putting a vector representing a deck of n cards into random order. You may use a function, randomInteger(n), which returns

Describe an efficient way of putting a vector representing a deck of n cards into random order. You may use a function, randomInteger(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 function?

Step by Step Solution

3.19 Rating (163 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

There are a few ways to approach this problem One way would be to iterate through the de... View full answer

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 Data Structures And Algorithms In C++ Questions!