8. Sorting in Linear Time
Exercises
8.1-1
8.1-2
8.1-3
8.1-4
8.2-1
// The array A and the auxiliary array C after line 5.
A[1:11]=[6,0,2,0,1,3,4,6,1,3,2]
C[0:6]=[2,2,2,2,1,0,2]
// The array C after line 8.
C[0:6]=[2,4,6,8,9,9,11]
// The output array B and the auxiliary array C after one, two, and
// three iterations of the loop in lines 11β13, respectively.
// Only the non-X elements of array B have been ο¬lled in.
B[1:11]=[X,X,X,X,X,2,X,X,X,X,X]
C[0:6]=[2,4,5,8,9,9,11]
B[1:11]=[X,X,X,X,X,2,X,3,X,X,X]
C[0:6]=[2,4,5,7,9,9,11]
B[1:11]=[X,X,X,1,X,2,X,3,X,X,X]
C[0:6]=[2,3,5,7,9,9,11]
// The ο¬nal sorted output array B.
B[1:11]=[0,0,1,1,2,2,3,3,4,6,6]8.2-2
8.2-3
8.2-4
8.2-5
8.2-6
8.2-7
8.3-1
8.3-2
8.3-3
8.3-4 π
8.3-5
β
8.3-6
8.4-1
8.4-2
8.4-3
8.4-4
β
8.4-5
β
8.4-6 π
Problems
8-1 Probabilistic lower bounds on comparison sorting
8-2 Sorting in place in linear time
8-3 Sorting variable-length items
8-4 Water jugs
8-5 Average sorting
a.
b.
c.
d.
e.
f.
8-6 Lower bound on merging sorted lists
a.
b.
c.
d.
8-7 The 0-1 sorting lemma and columnsort
Last updated