Link to home
Start Free TrialLog in
Avatar of angel7170
angel7170Flag for United States of America

asked on

MergeSort algorithm using Threads in JAVA

Hello,

I have to implement the merge sort algorithm by spawning a new thread
for each smaller MergeSorter. I need to use the join method of the Thread class to wait
for the spawned threads to ¿nish.
Here is what I have so far. How can I use multi-threading in MergeSort? Please assist.

Thank you
Arrayutil.txt
MergeSorter.java
MergeSorterDEmo.txt
Avatar of mccarl
mccarl
Flag of Australia image

I will go out on a limb here and assume that this is a homework type question, and so we can't actually do any of the coding work for you, but can give you some direction to learn what you need in order to complete this.

First, I would say that if you don't know about threading, trying to learn in the context of this problem is probably a bit too much. In this problem you will have additional things to take into consideration regarding the recursive nature of the algorithm, etc. Best to start on something a bit easier. I would suggest looking at the Java Concurrency Tutorials as a first step, and then trying your own simple multi-threaded program first. Once you have done this, it should be a little more obvious what you need to do in this MergeSort case.
ASKER CERTIFIED SOLUTION
Avatar of girionis
girionis
Flag of Greece image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of angel7170

ASKER

Thanks for the links