It is said that a particular partition algorithm can lead to a stable Quick Sort and I was wondering what the specifics would need to be to do this?
Would be helpful if anyone had a an example or tips to create such algorithm
It is said that a particular partition algorithm can lead to a stable Quick Sort and I was wondering what the specifics would need to be to do this?
Would be helpful if anyone had a an example or tips to create such algorithm
The Partition Algorithm is used as the "core" of the Quick Sort Algorithm. Using "wisely" the Partition Algorithm may lead to "stable" Quick Sort implementation.
Here is a quick summary of how the "Partition Algorithm" works: https://www.youtube.com/watch?v=MLpH7mpwOxQ
The goal of partition algorithm is to simply take some collection of elements (for example, you work with “arrays”) and then partitioning (or splitting!) this collection around the pivot into two parts — left part and right part.
There should be some "rule" regarding the elements on the left of pivot and on the right of the pivot. For example, all elements on the left will be smaller than the chosen pivot and all the elements on the right will be greater than the pivot.
Hope this helps!