Question: complete the code your code here Problem 1: MergeSort3 Way class (60') Description: Instead of dividing into half at each step, you are now supposed

 complete the code "your code here" Problem 1: MergeSort3 Way class
(60') Description: Instead of dividing into half at each step, you are
now supposed to divide recursively the initial array into thirds, sort each
complete the code "your code here"

Problem 1: MergeSort3 Way class (60') Description: Instead of dividing into half at each step, you are now supposed to divide recursively the initial array into thirds, sort each third, and then combine using a 3-way merge. Please implement a MergeSort3Way class so that arrays can be sorted by using Merge Sort 3-Way. Please read the numbers from the attached large W.txt file into an array, apply the 3-way sorting, and output the sorted results into a file large WResults.txt package hw6: class DArray private longt1 theArray: // ref to array theArray private int nlems; // number of data Items // publie Darray(int max) // constructor theArray - new long(max); // create array nel = 0 > // public void insert(long value) // put element into array therayin lens-value; // Insert it nalens +1 // Inerenent si > coverride publta string to tring() // displays array contents Steinghusider sb new stringbuilder() for (int - 01 Jam // for each element, sb.append(theArray" } // display it returnsb.tostring(1 ) // public void mergesort Way() // called by main() longt) workspace - now longilome) reMergesort Way workspace, 0, nelen-1) > 7 private void recergoway (long workSpace, int low, int high) // YOUR CODES private void merge long workspace, int low int midi, int mid2, int high) // YOUR CODES // @Override public String toString() // displays array contents StringBuilder sb = new StringBuilder(); for (int j = 0; j public void mergeSort 3way() // called by main() { long workspace = new long nElems); rechergesort 3way (workspace, 0, Elem-1); ) // --- private void recMergesort Way(long) workspace, int low, int high) { // YOUR CODES > private void merge long workspace, int low, int midi, int mida, int high) // YOUR CODES public void writeToFile(String filename) // YOUR CODES // Please add the try/catch statement for tile processing ) // end class Darray //////// public class Mergesort Way public static void main(String[] args) int maxsize - 1000001; // array size DArray arri // reference to array arr - new Darray(maxsixo); // create the array 7/ Read data from the file. Please add the try/catch statement for file processing 1/ Invoke Mergesort Way // write sorted data to Pile

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!