Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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. import java.util.*; 1 public class Sort3 { public static int[] quick_sort.lintilaccasamintheminta) { } public static int partition.LintIdmancavamintvkenint.cd. { } public static int[] counting sort.Cintilaccan mint..k) { } public static int[] generate_random_array (int n, int k) { List list; int[] array; Random rnd; rnd = new Random(System.currentTimeMillis(); list = new ArrayList (); for (int i = 1; i list; int[] array; list = new ArrayList (); for (int i = 1; i array[i]) return false; } return true; } public static void print_array (int[] array) { for (int i = 0; i
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started