Question: use c++ For this lab you will have to write 2 versions of quicksort all with different partition functions. One that uses the middle position
use c++
For this lab you will have to write 2 versions of quicksort all with different partition functions.
One that uses the middle position as the pivot and one uses the first position as the pivot.
Each version of the quicksort should keep track of the number of comparisons each function does.
Once you have written these two quicksorts and verified that they work.
Now comes the fun part. Ask the user for a size.
Test 1
Now make an ascending order vector of ints of that size;
Then sort the vector with both versions of your quicksort.
Print out the number of comparisons each quicksort does.
Test 2
Now make 2 random vectors of ints of that size.
Then sort these two vectors one per quicksort. Keep track of the counts. Now do it 1000 times.
Print out the average number of comparisons each quicksort does.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
