Question: I need help with creating the parfor code Exercise 2 - 50% of the mark This task is a variant of the well documented birthday

I need help with creating the parfor code

I need help with creating the parfor code Exercise 2 - 50%

of the mark This task is a variant of the well documented

Exercise 2 - 50% of the mark This task is a variant of the well documented birthday paradox' problem - you are required to calculate the probability of exactly two people (an two people) sharing a birthday on any day. To do this, 1. 2. I For a given number of people (we shall refer to this number as N) Calculate N random numbers in the range 1-365 (we will ignore leap years). If two (and only two) of the numbers are the same, we consider our criteria has been met and add one to a counter C. Repeat (2) & (3) a sufficiently large number of times (R) to get a statistically valid answer The probability is calculated as P(N) = (C/R) 3. 4. 5. * 100 The above steps to be done for a range of N from 2 to 200 (inclusive), a graph of N vs P(N) is then to be plotted 2. Using a parfor loop (15%) This section is for the version that uses a parfor loop. % Write your code here: Questions: T 1. Setting R=20, which is faster - the serial for loop or the parfor loop implementation? How many times faster? Write your answer here) 2. Setting R=2022 which is faster - the serial for loop or the parfor loop implementation? How many times faster? Explain this different result for different values of R. Write your answer here]

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!