Example of partitioning 10135 3211 66662 1310 3211 5555 310 13211 32 88888 131011 36 13|1011 Day 6 Introduction to Algorithms L4.16
Day 6 Introduction to Algorithms L4.16 Example of partitioning 66 1010 1313 55 88 33 22 1111 66 55 33 1010 88 1313 22 1111 66 55 1313 1010 88 33 22 1111 66 55 33 22 88 1313 1010 1111 i 22 55 33 66 88 1313 1010 1111
Pseudocode for quicksort QUICKSORT(A, p, r) ifp< then g Partition(A,p, r) QUICKSORT(A, P, -1) QUICKSORT(A, 9+1, r) Initial call: QUICKSORT(A, 1, n) Day 6 Introduction to Algorithms L4.17
Day 6 Introduction to Algorithms L4.17 Pseudocode for quicksort QUICKSORT(A, p, r) if p < r then q ← PARTITION(A, p, r) QUICKSORT(A, p, q–1) QUICKSORT(A, q+1, r) Initial call: QUICKSORT(A, 1, n)