hello
can anyone explain quick sort example using last element as pivot element. I know how to sort element using first and middle element as pivot element.
Printable View
hello
can anyone explain quick sort example using last element as pivot element. I know how to sort element using first and middle element as pivot element.
i know that process but when first partition is done means elements which is less than pivot is in left side and elements which is greater than pivot is in right side of pivot.
but what is the other process when this is done. when i take example and trace this step i m confused..SO can you explain with example?
Well, if you think about it: if you know how to do the partition with the first or the middle element as the pivot, then to do the partition with the last element as the pivot, just swap it with the first or middle element then do what you already know.