

















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!


















51
52
54
55
57
58
60
61
63
n = right – left +
Time: cn for some constant c
Space: constant
64
4 8 6 3 5 1 7 2
2 3 1 5 6 7 8
4
Partition
A:
66
2
4 5 6 7 8
1
1
3
Quick-Sort(A, 0, 0) , base case , return
67
2
4 5 6 7 8
1
33
Quick-Sort(A, 1, 1) , base case
69
4 2
1 3
5 6 7 8 6 7 8 5
Quick-Sort(A, 2, 2), return
Quick-Sort(A, 4, 7)
, partition
70
4
5
6 7 8
66 7 8
2
1 3
Quick-Sort(A, 5, 7)
, partition