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 16:30
Monica and her team have implemented is successfully in an organization. what factor leads to successful is implementation? good between different departments in an organization leads to successful is implementation.
Answers: 1
question
Computers and Technology, 23.06.2019 21:00
Alcohol’s affects on the cornea and lens of the eye make it more difficult
Answers: 1
question
Computers and Technology, 25.06.2019 04:00
What was the name of the first computer (machine) language?
Answers: 2
question
Computers and Technology, 25.06.2019 06:20
In your pest busters game, how does player 2 move the ship 2 object? a pressing the w and s keys b. pressing the up arrow and down arrow keys c. moving the mouse from side to side d. moving the mouse up and down select the best answer from the choices provided
Answers: 1
You know the right answer?
In this project, you will develop a multithreaded program to perform sorting that works as follows:...
Questions
question
Mathematics, 16.10.2020 09:01
question
Mathematics, 16.10.2020 09:01
question
Spanish, 16.10.2020 09:01
Questions on the website: 13722367