Question: Write a function to read the numbers into an array. Modify the code for Quicksort to count the number of comparisons as the sorting occurs.
Write a function to read the numbers into an array. Modify the code for Quicksort to count the number of comparisons as the sorting occurs. Run the algorithm on the array and print the number of comparisons. Then run Quicksort on the now sorted array, and print the number of comparisons.
Write a function to reverse the order of the array, so the elements are in descending order. Run Quicksort on the array sorted in reverse order, and print the number of comparisons.


public void quicksorti(int[ data, int min, int max) int pivot = 0; if (min pivot ) f swapi (data, left, right); / move pivot into proper place swapi (data,min,right); / return pivot position return right
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
