The language used here is in Java. Please answer the question in the screenshot. Please use the code below as a base. Please only answer question 2. import java.util.*; class SortingPack { // just in case you need tis method for testing public static void main(String[] args) { // something } // implementation of insertion sort // parameters: int array unsortedArr // return: sorted int array public static int[] insertionSort(int[] unsortedArr) { // to be removed return unsortedArr; } // implementation of quick sort // parameters: int array unsortedArr // return: sorted int array public static int[] quickSort(int[] unsortedArr) { // to be removed return unsortedArr; } // implementation of merge sort // parameters: int array unsortedArr // return: sorted int array public static int[] mergeSort(int[] unsortedArr) { // to be removed return unsortedArr; } // you are welcome to add any supporting methods } import java.util.*; public class SortingTest{ public static void main(String[] args) { SortingTest obj = new SortingTest(); // DO NOT DELETE THE THREE TEST cases obj.test("insertSort", 10); obj.test("quicktSort", 20); obj.test("mergeSort", 30); // you are welcome to add more testing cases } // test any one of the three given sorting
The language used here is in Java. Please answer the question in the screenshot. Please use the code below as a base. Please only answer question 2.
import java.util.*;
class SortingPack {
// just in case you need tis method for testing
public static void main(String[] args) {
// something
}
// implementation of insertion sort
// parameters: int array unsortedArr
// return: sorted int array
public static int[] insertionSort(int[] unsortedArr) {
// to be removed return unsortedArr;
}
// implementation of quick sort
// parameters: int array unsortedArr
// return: sorted int array
public static int[] quickSort(int[] unsortedArr) {
// to be removed return unsortedArr;
}
// implementation of merge sort
// parameters: int array unsortedArr
// return: sorted int array
public static int[] mergeSort(int[] unsortedArr) {
// to be removed return unsortedArr;
}
// you are welcome to add any supporting methods
}
import java.util.*;
public class SortingTest{
public static void main(String[] args) {
SortingTest obj = new SortingTest();
// DO NOT DELETE THE THREE TEST
cases obj.test("insertSort", 10);
obj.test("quicktSort", 20);
obj.test("mergeSort", 30);
// you are welcome to add more testing cases
}
// test any one of the three given sorting algorithms in SortingPack
// parameters:
// sortAlgorithm - string, name of the sorting
// size - int, the length of the randomly generated array
// no return data
public void test(String sortAlgorithm, int size) {
}
Trending now
This is a popular solution!
Step by step
Solved in 4 steps