Question: Need JAVA program for the below. Selection sort (recursive) Insertion sort (non-recursive) Merge sort (recursive) Run a statement like the following to sort the array

Need JAVA program for the below.

Selection sort (recursive)

Insertion sort (non-recursive)

Merge sort (recursive)

Run a statement like the following to "sort" the array that is containing the values in the decreasing order:

long startTime = System.currentTimeMillis(); methodA(25); long endTime = System.currentTimeMillis(); System.out.println("That method A for 25 took " + (endTime - startTime) + " milliseconds");

Do the same for methods B and C.

Give the time needed for each of the three sorting implementations

Then go ahead and run the same with an array of 10,000,000 elements still arranged from the largest value 10,000,000 through 1 and submit also the output in miliseconds.

Note: If an algorithm (of the three that you have to implement, or two or all) does not finish in a "reasonable" time, say 45 minutes for the highest value required for this assignment stop the execution and mention that the algorithm did not finish in a reasonable time. Before doing so make sure that you test and debug your implementation properly and make sure there are no bugs and you implemented correctly the algorithm.

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!