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
-
A solid sphere of radius \(R\) carries a fixed, uniformly distributed charge \(q\). Exploiting the analogy between Newton's law of gravity and Coulomb's law, use the result obtained in Section 13.8...
-
What report expresses goals in financial terms? a. performance report b. financial statement c. budget d. chart of accounts
-
Use the information contained below to compress one time unit per move using the least cost method. Reduce the schedule until you reach the crash point of the network. For each move identify what...
-
We work with many people in special events, fundraising, patient care and medical personnel. We need to know who our stakeholders are and their values, motivations and barriers. We want to know this...
-
1. Stan Richards believes that the way you treat your people is exactly how they treat clients. Do you agree or disagree? Explain your reasoning. 2. Evaluate Richards belief that creativity requires...
-
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...
-
Which species are more likely to act as ligands? (a) Positively charged ions or negatively charged ions? (b) Neutral molecules that are polar or those that are nonpolar?
-
How can the scope of services be adjusted to best meet management's needs and still preserve the professionalism of internal auditing?
-
Distinguish between "hard data" and "soft data."
-
What would be the consequences of issuing internal audit reports containing unsubstantiated claims?
-
List four qualitative factors that the auditor should consider when evaluating the unadjusted misstatements detected during the audit.
-
Why conduct a preliminary survey for an audit?
-
Currington Company wants to use absorption cost-plus pricing to set the selling price on a newly remodeled product. The company plans to invest $150,000 in operating assets to produce and sell 12,000...
-
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...
-
Alex is a salesperson andhas beenemployed byCCI for several years. CCI is aCanadian controlled private corporation (CCPC). Thecompanycarries ona business of selling clothing through retail outlets in...
-
What is the option premium in USD with the following characteristics? S K T id = current spot price in USD/YEN = forward contract price in USD / YEN = six months = six-month interest rate in USD if =...
-
En la mayora de pases el pasivo y el activo de un balance se ordena comenzando por arriba
Study smarter with the SolutionInn App