Menu

[Solved]4 Analysis Arised Bucket Sort Suppose One Experiment Generate N Random Numbers Range 1 N L Q37300799

4 Analysis Arised from Bucket Sort Suppose in one experiment, we generate n random numbers in the range 1 through n. Let ther

From the two examples, we see that the rewards can vary as the outcome varies. We wonder what the expected reward is given th

4 Analysis Arised from Bucket Sort Suppose in one experiment, we generate n random numbers in the range 1 through n. Let there be ci occurrences of i, wherei 1,2,… ,n. As there are n numbers generated, we have 1ci-n. We compute a reward for the outcome as Σί_1 ci 2. e a reward fr Example 1. Let n 5. We generate 5 random integers in the range 1 through 5. Suppose the 5 numbers generated are 4, 2, 1, 2, 2. We have ci- 1, c2 3, c30, c4 and cs0. The reward 22c42c52 12 32 01202 190+1+0 11 Example 2. Let n = 5, We generate 5 randon integers in the range 1 through 5. Suppose the 5 numbers generated are 3, 1, 1, 5, 3. We have c2 c2 0, c3 2, c40 and c 1. The reward is 22c2c2 22222212 4 0+401 9. From the two examples, we see that the rewards can vary as the outcome varies. We wonder what the expected reward is given that the random number generator is fair, and each generation is independent from the other generations. Suppose we repeat the experiment for m times with rewards rı, r2, …Tm The expected reward is calculated as 12-n. Task 3 Let n = 5, write a Java program to run the experiment for 10000 times. Compute the expected reward Show transcribed image text 4 Analysis Arised from Bucket Sort Suppose in one experiment, we generate n random numbers in the range 1 through n. Let there be ci occurrences of i, wherei 1,2,… ,n. As there are n numbers generated, we have 1ci-n. We compute a reward for the outcome as Σί_1 ci 2. e a reward fr Example 1. Let n 5. We generate 5 random integers in the range 1 through 5. Suppose the 5 numbers generated are 4, 2, 1, 2, 2. We have ci- 1, c2 3, c30, c4 and cs0. The reward 22c42c52 12 32 01202 190+1+0 11 Example 2. Let n = 5, We generate 5 randon integers in the range 1 through 5. Suppose the 5 numbers generated are 3, 1, 1, 5, 3. We have c2 c2 0, c3 2, c40 and c 1. The reward is 22c2c2 22222212 4 0+401 9.
From the two examples, we see that the rewards can vary as the outcome varies. We wonder what the expected reward is given that the random number generator is fair, and each generation is independent from the other generations. Suppose we repeat the experiment for m times with rewards rı, r2, …Tm The expected reward is calculated as 12-n. Task 3 Let n = 5, write a Java program to run the experiment for 10000 times. Compute the expected reward

Expert Answer


Answer to 4 Analysis Arised from Bucket Sort Suppose in one experiment, we generate n random numbers in the range 1 through n. Let… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *