1procedure quickSort(A, low, high)
2 if low < high then
3 p ← partition(A, low, high)
4 quickSort(A, low, p - 1)
5 quickSort(A, p + 1, high)
6procedure partition(A, low, high)
7 pivot ← A[high]
8 i ← low - 1
9 for j ← low to high - 1 do
10 if A[j] ≤ pivot then
11 i ← i + 1
12 swap A[i] and A[j]
13 swap A[i+1] and A[high]
14 return i + 1