Question: 2. Assume that you have a routine, random (a,b), that inputs two integers a,b and returns a uninformly distributed random integer between a and b,

 2. Assume that you have a routine, random (a,b), that inputs

2. Assume that you have a routine, random (a,b), that inputs two integers a,b and returns a uninformly distributed random integer between a and b, inclusive (a) Write a routine that inputs an array and randomly permutes the elements (so that each permutation is equally likely). You may look this up if you like (but try it yourself first) (b) Exactly how many moves and/or exchanges does your algorithm use (in the worst case)

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 Databases Questions!