Question: Pls answer correctly and explain solution. Prev chegg answers were incorrect 3. Suppose you wanted to create a new quicksort-inspired algorithm that has worst-case (n

Pls answer correctly and explain solution. Prev chegg answers were incorrectPls answer correctly and explain solution. Prev chegg answers were incorrect 3.

3. Suppose you wanted to create a new quicksort-inspired algorithm that has worst-case (n logn) complexity. Which of the following designs would achieve this goal? Select all that apply. A. Before partitioning, check if the input is nearly sorted, then perform insertion sort instead. B. Only perform at most log2(n) levels of recursion, and then switch to mergesort. C. Always use the middle element in the list as the pivot instead of the last. D. Shuffle the elements in the array after each stage of partitioning. E. None of the above designs would work. 4. Which of the following is/are TRUE about sorting functions? Select all that apply. A. The most optimal partitioning policy for quicksort on an array we know nothing about would be to select a random element in the array as our pivot. B. The fastest possible comparison sort has a worst-case no better than O(nlogn). C. Heapsort is usually best when you need a stable sort. D. Sorting an already sorted array of size n with quicksort takes (nlogn) time. E. When sorting elements that are expensive to copy, it is generally best to use mergesort. F. Quicksort will always sort an array faster than an elementary sort

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!