The following algorithm will generate a random permutation of the elements 1,2, ..., n. It is somewhat faster than the one presented in Example 1a, but is such that no position is fixed until the algorithm ends. In this algorithm,
Step 1. Set
Step 2. Set
Step 3. If
Step 4. Generate a random number U and let
Go to step 3.
a. Explain in words what the algorithm is doing.
b. Show that at iteration k—that is. when the value of P(k) Is initially set—
P(1), P(2), ..., P(k) is a random permutation of 1, 2, ..., k.
Hint: Use induction and argue that
(a)
To find: the explanation that the algorithm is doing.
Explanation of Solution
Given:
Some steps of algorithm are given.
The algorithm starts by initially putting k=1 thus it sets
Then, until
This algorithm start by putting
Therefore, therequired explanation is shown above.
(b)
To prove:that the set
Explanation of Solution
Given:
It is given that
As it is given that the condition
It is known that;
Then, the given condition becomes;
Similarly,
This proves that at iteration k can be defined as
Therefore, the required identity has been proved.
Want to see more full solutions like this?
Chapter 10 Solutions
A First Course in Probability (10th Edition)
Additional Math Textbook Solutions
Probability and Statistical Inference (9th Edition)
Probability And Statistical Inference (10th Edition)
Business Analytics
Calculus for Business, Economics, Life Sciences, and Social Sciences (14th Edition)
College Algebra (5th Edition)
Numerical Methods for Engineers
- Linear Algebra: A Modern IntroductionAlgebraISBN:9781285463247Author:David PoolePublisher:Cengage LearningElements Of Modern AlgebraAlgebraISBN:9781285463230Author:Gilbert, Linda, JimmiePublisher:Cengage Learning,Algebra & Trigonometry with Analytic GeometryAlgebraISBN:9781133382119Author:SwokowskiPublisher:Cengage