Question: Implement QuickSort, as explained in class, with varying pivot calculation methods and varying cutoffs. Please write a c++ code for the question as the picture

Implement QuickSort, as explained in class, with varying pivot calculation methods and varying cutoffs.

Please write a c++ code for the question as the picture show, thanks.

Implement QuickSort, as explained in class, with varying pivot calculation methods and

Problem 4 (5+2 marks). (a) Implement QuickSort, as explained in class, with varying pivot calculation methods and varying cutoffs. You may assume that all your input lists contain only integers, are duplicate-free, and are of length at most 100 pivot calculation methods: pivot first list element, pivot-second list element, pivot-element at middle position of list, pivot - median-of-three (as explained in class) cutoffs: no cutoff, cutoff c = 5, cutoff c = 10, cutoff c = 20 (a cutoff here means an array size such that every array of size less than or equal to c will be sorted with Insertion Sort). Add a counter to your implementation. Every time a comparison of two list elements is made, the counter is increased by one (also in the Insertion Sort routine). (b) Test your implementation (all 4 x 4 16 variants) on three different lists of length 100 and, each time, report order, one sorted in decreasing order, and one random. Show the 48 resulting values organized in a table, for better readability. Problem 4 (5+2 marks). (a) Implement QuickSort, as explained in class, with varying pivot calculation methods and varying cutoffs. You may assume that all your input lists contain only integers, are duplicate-free, and are of length at most 100 pivot calculation methods: pivot first list element, pivot-second list element, pivot-element at middle position of list, pivot - median-of-three (as explained in class) cutoffs: no cutoff, cutoff c = 5, cutoff c = 10, cutoff c = 20 (a cutoff here means an array size such that every array of size less than or equal to c will be sorted with Insertion Sort). Add a counter to your implementation. Every time a comparison of two list elements is made, the counter is increased by one (also in the Insertion Sort routine). (b) Test your implementation (all 4 x 4 16 variants) on three different lists of length 100 and, each time, report order, one sorted in decreasing order, and one random. Show the 48 resulting values organized in a table, for better readability

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!