Revise Listing 32.10, ParallelMergeSort.java, to define a generic parallelMergeSort method as follows: public static > void parallelMergeSort(E[]
Question:
Revise Listing 32.10, ParallelMergeSort.java, to define a generic parallelMergeSort method as follows:
public static > void
parallelMergeSort(E[] list)
Data from Listing 32.10,
Transcribed Image Text:
1mport java.util.concurrent. RecursiveAction; 2 1mport java.util.concurrent. ForkJoinPool; 4 publ1c class ParallelMergeSort { publ1c stat1c void main(String[] args) { final int SIZE = 7000000; 1nt[] list1 = new int[SIZE]: int [] list2 = now int[SIZE]: 5 6 7 8 for (1nt i = 0: 1< list1.length; i++) listi[i] = list2[i] = (1nt) (Math.random () 10000000); 10 11 12 Tong startTime = System.currentTimeMillis (): parallelMergeSort (list1):: // Invoke parallel merge sort Tong endTime = System.currentTimeMillis (): System.out. printin("\nParallel time with " + Runtime.getRuntime ().availableProcessors () + " processors 1s " + (endTime - startTime) + " m1111seconds"): 13 14 15 16 17 18 19 20 startTime = System.currentTimeMillis(): MergeSort.mergeSort (list2); // MergeSort is in Listing 23.5 endTime = System.currentTimeMillis (): System.out.printin("inSequential time 1s "+ (endTime - startTime) + " m1111seconds"): 21 22 23 24 25 26 public static void parallelMergeSort (1nt [] list) { RecursiveAction mainTask = new SortTask (list): ForkJoinPool pool = new ForkJoinPool (): pool. invoke (mainTask): 27 28 29 30 31 32 33 private static class SortTask extends RecursiveAction{ private final int THRESHOLD = 500; 34 1234t 567 o
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 60% (10 reviews)
import javautilconcurrentRecursiveAction import javautilconcurrentForkJoinPool public class Exercise3213 public static void mainString args final int SIZE 700000 Integer list1 new IntegerSIZE Integer ...View the full answer
Answered By
ANDREW KIPRUTO
Academic Writing Expert
I have over 7 years of research and application experience. I am trained and licensed to provide expertise in IT information, computer sciences related topics and other units like chemistry, Business, law, biology, biochemistry, and genetics. I'm a network and IT admin with +8 years of experience in all kind of environments.
I can help you in the following areas:
Networking
- Ethernet, Wireless Airmax and 802.11, fiber networks on GPON/GEPON and WDM
- Protocols and IP Services: VLANs, LACP, ACLs, VPNs, OSPF, BGP, RADIUS, PPPoE, DNS, Proxies, SNMP
- Vendors: MikroTik, Ubiquiti, Cisco, Juniper, HP, Dell, DrayTek, SMC, Zyxel, Furukawa Electric, and many more
- Monitoring Systems: PRTG, Zabbix, Whatsup Gold, TheDude, RRDtoo
Always available for new projects! Contact me for any inquiries
4.30+
1+ Reviews
10+ Question Solved
Related Book For
Introduction To Java Programming And Data Structures Comprehensive Version
ISBN: 9780136520238
12th Edition
Authors: Y. Daniel Liang
Question Posted:
Students also viewed these Computer science questions
-
Revise Listing 30.10, ParallelMergeSort.java, to define a generic parallelMergeSort method as follows: Listing public static void parallelMergeSort(E[] list) 1 import...
-
Revise Figure to make it a list of criteria for assessing an application service provider (ASP). The Package Functional capabilities of the packaged system Technical requirements the software must...
-
Fed Ltd. ("Fed") is a canned food manufacturer located in the Eastern Cape. The entity has a 30 June financial year-end. Fed manufactures the following product lines: Canned chickpeas Canned...
-
Esther earned 528.00 for the week. If she saved 128.00, how many percent of her earnings for the week did she save?
-
What is the constant k that makes the following function valid density? fx (z) = 0 otherwise
-
Which samples show unequal variances? Use = .05 in all tests. Show the critical values and degrees of freedom clearly and illustrate the decision rule. a. s1 = 5.1, n1 5 11, s2 = 3.2, n2 = 8,...
-
An often-ignored concept in breach of contract is the availability, if any, of the award of punitive damages. Often, cases incorporate both breach of contract and tort actions. The tort actions...
-
Northeast General, a large hospital in Providence, Rhode Island, has initiated a new procedure to ensure that patients receive their meals while the food is still as hot as possible. The hospital...
-
7. In each of the following scenarios, a through d, determine whether the following is a microeconomic or macroeconomic issue and WHY. a. Dell computers announces that it will raise the price of its...
-
The financial statements of Procter & Gamble Company provide the context for this question which focuses on long-term debt and stockholders equity. This question demonstrates how the concepts in this...
-
Programming Exercise 8.5 describes how to perform matrix addition. Suppose you have multiple processors, so you can speed up the matrix addition. Implement the following method in parallel: public...
-
Rewrite Listing 32.6, ThreadCooperation.java, using the objects wait() and notifyAll() methods. Data from Listing 32.6, 1mport java.util.concurrent.: 2 1mport java.util.concurrent. locks.: 1 3 4...
-
A 2014 article from Business Insider (http://www.business insider.com/department-of-justice report- shows-high-recidivism-rate-2014-4) discusses recidivism rates in the United States. Recidivism is...
-
TOPIC SELECTION Following the visit to the Archives, students will select a topic on which they would like to work. A list of possible topics will be given to you at your Archives tour. Once a topic...
-
"Competition in the U.S. Airline Industry" and answer the following Case Discussion Questions: Was the flood of new entrants into the airline industry that followed deregulation in 1978 good for...
-
Inside an alveolus (a hollow cavity in lung tissue) with a 1.9 10 -4 m radius the gauge pressure due to the surface tension of the fluid lining the wall is 1.3 10 3 Pa. Assuming the alveolus acts...
-
Instructions: Below are the details to a specific scenario and instructions on how to present your findings. Scenario You tell your supervisor that you are taking a communication class. The...
-
During a testing process, a worker in a factory mounts a bicycle wheel on a stationary stand and applies a tangential resistive force of 120 N to the tire's rim. The mass of the wheel is 1.90 kg and,...
-
A block of wood, with density 780 kg/m3, has a cubic shape with sides 0.330 m long. A rope of negligible mass is used to tie a piece of lead to the bottom of the wood. The lead pulls the wood into...
-
Determine the values of the given trigonometric functions directly on a calculator. The angles are approximate. tan 0.8035
-
Revise Exercise 31.1 for the client to send a loan object that contains annual interest rate, number of years, and loan amount and for the server to send the monthly payment and total payment. Write...
-
Develop a client/server application to view and add addresses, as shown in Figure 31.20. ? Use the StudentAddress class defined in Listing 31.5 to hold the name, street, city, state, and zip in an...
-
Programming Exercise 22.12 retrieves the last 100 prime numbers from a file PrimeNumbers.dat. Write a client program that requests the server to send the last 100 prime numbers in an array. Name the...
-
A near maximum of a list is an element in the list, which is bigger than both the items that are immediately before and after it. e.g. in the list [2, 4, 6, 1, 9], the only near maximum is 6, since...
-
Some of the questions below are taken from or based on questions in Tanenbaum, Structured Computer Organisation, 5th edition. 1. Draw the logic diagram for a 3-bit synchronous counter which counts...
-
You are given the following weighted graph and you have to find the shortest path in the graph from A to H using the fastest possible algorithm. 2 B 3 A 1 1 D 2 3 E - 3 H a) Which of the three...
Study smarter with the SolutionInn App