




















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





















n <= 1 elements. n <= 10 elements. We’ll use n <= 1 for now.
Divide into k >= 2 smaller instances. k = 2, 3, 4, …? What does each smaller instance look like? Sort smaller instances recursively. How do you combine the sorted smaller instances?Docsity.com
a[0] (^) a[n-2] a[n-1]
C = (1, 2, 3, 5) Docsity.com
t(n) = t(ceil(n/2)) + t(floor(n/2)) + dn, where d is a constant.
6 2 8 5 11 10 4 1 9 7 3
Use 6 as the pivot.
2 5 4 1 3 6 7 9 10 11 8
Sort left and right groups recursively.
If a[6].key = 30, a[13].key = 25, and a[20].key = 10, a[13] becomes the pivot.
pivot
swap