Question: 1 Problem Description Instructions. You are provided the skeleton code named Sort2.java. The source file is available on Canvas in a folder named HW2. Please



1 Problem Description Instructions. You are provided the skeleton code named Sort2.java. The source file is available on Canvas in a folder named HW2. Please modify the skeleton code to solve the following tasks. Task 1 (40 pts). Implement the Quick Sort algorithm as discussed in Lecture 4. (Hint: use the function checked.sorted to check if your output is indeed sorted.) Task 2 (40 pts). Implement the Counting Sort algorithm as discussed in Lecture 4. (Hint: use the function checked.sorted to check if your output is indeed sorted.) Task 3 (20 pts). Generate a report to discuss the time performance of the two algorithms. Compare it with their theoretical time complexity as discussed in the lecture. Plots and figures are encouraged to help draw the conclusion Optional Task 4 (100 pts Extra Credit). Implement the Heap Sort algo- rithm as discussed in Lecture 3. (Hint: use the function checked sorted to check if your output is indeed sorted.) package sorting: import java.util.*; public class Sort2 public static intfi merge_sort (int array, int p, int r) i *fill in your program return array: public static int[i merge (int array, int p, int a, int r) [ fill in your program return array: *n: the size of the output array * k: the maximum value in the array public static int[i generate random_array (int n, int k) 11st; List
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
