Question: Hey i need some help with this code 1.- Using (Generic quick sort) Write the following two generic methods using quick sort. The first method

Hey i need some help with this code

1.- Using (Generic quick sort) Write the following two generic methods using quick sort. The first method sorts the elements using the Comparable interface and the second uses the Comparator interface. Use the first element as a pivot.

public static > void quickSort(E[] list)

public static void quickSort(E[] list,

Comparator comparator)

Output:

-2 1 2 2 3 3 5 6 12 14

ABC abc abm Anf Bad Good nice

2.

  • Create a new class called DemoSortingPerformacne
  • Create a private method called getRandomNumberArray. It returns an array of Integer and has 2 parameters: arraySize of type int and numberOfDigits of type int. This method should create an array of the specified size that is filled with random numbers. Each random numbers should have the same number of digits as specified in the second parameter
  • In your main method (or additional private methods) do the following: Execute selection sort on quick sort on a number of arrays and display the time it took to sort the arrays in a tabular form as described below
    • The table should have a header line. Each row should display the number of elements in the array and the times in took to sort the arrays using Selection and Quick sort
    • Each row in the table should duplicate the array size of the prior row That means for each row a new random array of numbers needs to be created
    • Make sure to create a copy so that both sorting methods are called on the identical array.
    • The table should have at least 7 lines

Please Help

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!