subject

In this project, you will develop a multithreaded program to perform sorting that works as follows: a
list of integers is divided into two smaller sublists. two separate threads (which we will term sorting
threads) sort each sublist using the selection sorting algorithm. the two sublists are then merged by a
third thread—a merging thread —which merges the two sublists into a single sorted list.

graphically, this program is structured according to the following figure:
original list (7, 12, 19, 3, 18, 4, 2, 6, 15, 8)
sorting thread0 (3, 7, 12, 18, 19) sorting thread1(2, 4, 6, 8, 15)
merging thread(2, 3, 4, 6, 7, 8, 12, 15, 18, 19)

this programming project will require passing parameters to each of the sorting threads. in particular,
it will be necessary to identify the starting index from which each thread is to begin sorting. the
parent thread will output the sorted array once all sorting threads have exited.

data structure
because data are shared cross all threads, perhaps the easiest way to set up the data is to create an
array. each sorting thread will work on one half of this array. a second array of the same size as the
unsorted integer array will also be established. the merging thread will then merge the two sublists
into this second array.

program structure
the program consists of the following classes:
1) mergesort: main method performs the following tasks:
a. prompt user to enter the data (a list of integers).
b. create two threads and use them to sort the first half and the second half of the list.
c. create a thread to merge the two sublists into a single list.
d. display the sorted list.
2) sortthread: implements run method. sort the elements in an array with index range
start, end using the selection sort algorithm
3) mergethread: implements run method. merge a list whose first half and second half are
sorted into a new sorted list.

the following is a sample run of the program:
enter the size of the sequence: 11
enter the numbers to be sorted : 9 2 8 11 4 67 34 4 19 10 23
the sorted list is: 2 4 4 8 9 10 11 19 23 34 67

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 02:30
Rafael needs to add a title row to a table that he has inserted in word. what should he do? use the alignment options. use the merge and center option for all the cells in the top row. use the merge and center option on the first two cells in the top row. none of the above
Answers: 3
question
Computers and Technology, 23.06.2019 08:30
When you interpret the behavior of others according to your experiences and understanding of the world your evaluation is
Answers: 1
question
Computers and Technology, 23.06.2019 18:40
Johnson enterprises uses a computer to handle its sales invoices. lately, business has been so good that it takes an extra 3 hours per night, plus every third saturday, to keep up with the volume of sales invoices. management is considering updating its computer with a faster model that would eliminate all of the overtime processing.
Answers: 2
question
Computers and Technology, 23.06.2019 23:30
Perform an online search about the booting process of a computer and list all the steps
Answers: 2
You know the right answer?
In this project, you will develop a multithreaded program to perform sorting that works as follows:...
Questions
question
History, 06.11.2020 20:00
question
German, 06.11.2020 20:00
Questions on the website: 13722363