Question: In java Part 4 Create a method with the following header: public static void runJavaSort ( int [ ] ar ) This method should call
In java
Part
Create a method with the following header:
public static void runJavaSortint ar
This method should call the Arrays.sort to sort ar
Note: Arrays.sort uses a combination of sorts to sort the data quicksort mergesort, insertion sort, and heapsort
Part
public static void bubbleSortint ar
Implement the bubble sort algorithm. It should sort the int parameter. Here is the pseudocode for bubble sort:Part
Test both sorts in main:
Call runJavaSort on ar
Call bubbleSort on ar
Show both sorted arrays on screen.
Part
Run each sort in main and calculate how many nanoseconds it takes for each to run. You should print the results on screen.
Here is sample code to get the current time in nanoseconds:
long currentTime System.nanoTime;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
