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
-
For calendar-year taxpayers, the normal filing due dates for business returns are: March 15 for Schedule C (Form 1040), and Forms 1120, 1120-S, and 1065. March 15 for Forms 1120, 1120-S, and 1065....
-
What do you think of a company asking employees to take a pay cut or work fewer hours so that no one has to be laid off? How willing would you be to do something like that?
-
A project costs $1 million and has a base-case NPV of exactly zero (NPV = 0). What is the projects APV in the following cases? a. If the firm invests, it has to raise $500,000 by a stock issue. Issue...
-
if tax law partnership under s995-1 ITAA97: (a) Partnership T: general law partnership 10 taxation law partnership is WF taxation law partnership General law partnership facts in the background. EXTE...
-
The Sock Company buys hiking socks for $6 a pair and sells then for $10. Management budgets monthly fixed costs to be $12,000 per month. Required (consider each of the following questions...
-
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...
-
At the beginning of her current tax year, Angela purchased a zero-coupon corporate bond at original issue for $30,000 with a yield to maturity of 6 percent. Given that she will not actually receive...
-
Companies that engage international business do so in pursuit of a broad range of goals. Nonetheless, the text identifies key drivers, noting that the typical company expands operations...
-
How do lifestyle changes, such as urbanization or an aging population, affect consumer needs and preferences in our industry?
-
Verify that the following general thermodynamic property relationships are valid for the specific case of an ideal gas: (a) T = au (b) P = -9) av
-
Performance management systems that do not make true contribution to the organizational goals are not true performance management systems. List and describe at least five contributions a good...
-
How do cognitive biases, such as confirmation bias and anchoring, influence strategic decision-making processes at the executive level, and what measures can be implemented to mitigate their impact ?
-
In an integrated bookkeeping system, when the actual production overheads exceed the absorbed production overheads, the accounting entries to close off the production overhead account at the end of...
-
Determine the center and radius of each circle. Sketch each circle. 4x 2 + 4y 2 9 = 16y
-
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...
-
Trey is single and has no qualifying child. His adjusted gross income is $12,355. In order to claim the Earned Income Tax Credit, he must meet which of the following requirements? He cannot be the...
-
Caspian Sea Drinks needs to raise $74.00 million by issuing additional shares of stock. If the market estimates CSD will pay a dividend of $2.69 next year, which will grow at 3.45% forever and the...
-
i need help in B and C Integrative Case 5-72 (Algo) Cost Estimation, CVP Analysis, and Decision Making (LO 5-4.5.9) Luke Corporation produces a variety of products, each within their own division....
Study smarter with the SolutionInn App