Question: Program Requirements Implement in Java two versions of the Quicksort algorithm: HOARE-QUICKSORT and LOMUTO-QUCCKSORT. Please follow the pseudocode of these two algorithms discussed in class,
Program Requirements Implement in Java two versions of the Quicksort algorithm: HOARE-QUICKSORT and LOMUTO-QUCCKSORT. Please follow the pseudocode of these two algorithms discussed in class, which can be found on Module 2 lecture slides - Part 3. Please make sure your program for the two algorithms will sort any input array into non-decreasing order. For each of these two versions of Quicksort algorithms, please add two static counters to your program, one to track the number of key comparisons (KCs) and the other to track the number of swaps. The output of your program should include the total number of KCs and the total number of swaps made by each Quicksort algorithm. You may run your program on small input arrays to check correctness. Complete the Following Tasks a. (16 points) Programming. Submit one .z1p file including all source files of your program for grading. You will get 0 points for this part if your program docs not complle. b. (10 points) Run your program multiple times on different input arrays as described in the first two columns of the following table. Fill out this table based on your program's outputs. Please also insert screenshots of your program's output for each run. c. (4 points) Based on the zesults you obtainod in part b, given the same input array, does one version of the Quicksort algorithm always perform better (better means with less number of KCy AND less number of swaps as well) than the other? If your answer is no, then in which case(s) does one Quicksort algorithm perform better than the other
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
