Objective : Implement the mergesort algorithm using Java generics. Description :
ID: 3760779 • Letter: O
Question
Objective: Implement the mergesort algorithm using Java generics.
Description:
First, download the driver and dictionary files, and place them in your project directory
Create a class MergeSorter.java that implements the mergesort algorithm in a generic way (i.e. over items that extend the Java Comparable interface). You may use this file as a template. Your goal is twofold:
Genericize the mergesorter class using ArrayLists rather than arrays.
Fill in the recursive portion of the mergesort algorithm within the `mergesort' method (annotated for you) In addition, the driver times the speed of your mergesort algorithm. After you have completed the above, you should try using LinkedLists rather than ArrayLists, and see how the time changes.
NOTE: Be careful with your parameters to ensure they will only take types of List, and not ArrayList
Example Dialog:
Checking merge algorithm: Success! Initial (int) array of size 76066 is sorted: false Mergesort: 214.883256 ms Integer array sort successful. Simple string sort: the quick brown fox jumps over the lazy dog brown dog fox jumps lazy over quick the the Initial (String) array of size 57578 is sorted: false Mergesort: 192.520276 ms String array sort successful. Note The driver is randomized, so your output will be different Finally: Upload the .java file to the dropbox
Driver File:
File to Ammend: