Question: (JAVA) Does anybody can help me with this? I don't understand. 2. Create a generic class named ArraySorter that implements the SortsArray interface public interface

(JAVA) Does anybody can help me with this? I don't understand.

(JAVA) Does anybody can help me with this? I don't understand. 2.

2. Create a generic class named ArraySorter that implements the SortsArray interface public interface SortsArray { void insertionSort(Comparator compare, E[] data); void bubblesort(Comparator compare, E[] data); void selectionSort(Comparator compare, E[] data); int getNumberofSwaps (); int getNumberofComparisons (); double getSortTime(); Each method should implement the named simple sort algorithm on the array data. Use the Comparator to determine the order of the items in the array. Sort the arrays in ascending order. The 'smallest' element should be in position 0, 1largest in data.length - 1. The methods should keep track of the number of comparisons, number of swaps and the amount of time it took to sort the array. To record the time taken, your code should call System.nanoTime at the beginning of each of the methods and save the value as the start time. It should then call System.nanoTime again at the end, and print the difference between the two times. The difference may be zero if your system clock does not update the time quickly enough, but otherwise should accurately report how many nanoseconds (billionths of a second) it took to execute your code. When the sort methods complete they should report the number of comparison, swaps, and the execution time in nanoseconds. Requirements Ensure that your implementation has the following characteristics: The Bigo for insertion and bubble sort on sorted data must be Bigo(n); o The number of swaps for all three sorts on sorted data must be 0

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!