Question: Implement the following method using the Fork/Join Framework to assign random values to the list. public static void parallelAssignValues(double[] list) Write a test program that
Implement the following method using the Fork/Join Framework to assign random values to the list.
public static void parallelAssignValues(double[] list)
Write a test program that creates a list with 9,000,000 elements and invokes parallelAssignValues to assign random values to the list. Also implement a sequential algorithm and compare the execution time of the two. Note that if you use Math.random(), your parallel code execution time will be worse than the sequential code execution time because Math.random() is synchronized and cannot be executed in parallel. To fix this problem, create a Random object for assigning random values to a small list.
Step by Step Solution
3.50 Rating (163 Votes )
There are 3 Steps involved in it
Program Plan Find the starting time ending time with using currentTimeMillis 0 Calculate the sequent... View full answer
Get step-by-step solutions from verified subject matter experts
