Question: Question 1) QuickSort is not a stable sorting algorithm which means that repeated elements dont have to appear in the same order after the sort
Question 1) QuickSort is not a stable sorting algorithm which means that repeated elements dont have to appear in the same order after the sort is completed. For example, if there are 3 values of x and you choose the first occurrence of x as a pivot then the other two x values end up to the left of the pivot. Modify quicksort in order to make it a stable sorting algorithm. Please note that the algorithm needs to work exactly the same but you are free to add pre-processing or post-processing as long as it takes no more than O(n).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
