An Introduction to Randomized algorithms - School of Technology ...
An Introduction to Randomized algorithms - School of Technology ...
An Introduction to Randomized algorithms - School of Technology ...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>Randomized</strong> Version : RandQSort(A, p, q):If p ≥ q, EXIT.Choose uniformly at random r ∈ {p, . . . , q}.s ← correct position <strong>of</strong> A[r] in the sorted order.Move randomly chosen pivot A[r] in<strong>to</strong> position s.Move the remaining elements in<strong>to</strong> ”appropriate” positions.RandQSort(A, p, s − 1);RandQSort(A, s + 1, q).