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, 21.06.2019 22:40
Write an assembly program with the following specifications.a). in the main block, you should have two registers r4 and r5. they should be checked in an infinite loop. if r4 is greater than r5, then the greater subroutine will be called. if r4 is less than r5, then the less subroutine will be called. if r4 equals r5, then no operations will be done
Answers: 1
question
Computers and Technology, 22.06.2019 15:00
I'm taking a class on how to make a movie, and it offers some apps that would be in the process. the thing is, i don't have any of those ha. if you have any tips on some apps i could use, that would be awesome. i don't have an iphone, so don't suggest any apps like imovie. i know that this is a weird question, but it would be super for me. : )
Answers: 2
question
Computers and Technology, 22.06.2019 18:00
Determine whether the following careers would require training or college.
Answers: 1
question
Computers and Technology, 23.06.2019 18:30
Write a program that prints the day number of the year, given the date in the form month-day-year. for example, if the input is 1-1-2006, the day number is 1; if the input is 12-25-2006, the day number is 359. the program should check for a leap year. a year is a leap year if it is divisible by 4, but not divisible by 100. for example, 1992 and 2008 are divisible by 4, but not by 100. a year that is divisible by 100 is a leap year if it is also divisible by 400. for example, 1600 and 2000 are divisible by 400. however, 1800 is not a leap year because 1800 is not divisible by 400.
Answers: 3
You know the right answer?
In this project, you will develop a multithreaded program to perform sorting that works as follows:...
Questions
Questions on the website: 13722363