You are on page 1of 1

Quick Sort 1

28 September 2020 09:54

Quick Sort (A, p, r)

if (p < r) then
q ← Partition (A, p, r)

Quick Sort (A, p, q-1)

Quick Sort (A, q+1, r)

Partition (A, p, r)
x = A[r]
i=p-1
for j = p to r-1 do
if A[j] < x then
i = i +1
exchange A[i] and A[j]
exchange A[i+1] and A[r]
return (i+1)

FOCA M3 Page 1

You might also like