The limits of sorting
1.[3p] Why must a correct comparison sort of distinct elements have at least leaves in its decision tree?
Why must a correct comparison sort of distinct elements have at least leaves in its decision tree?
2.[2p] What is the smallest number of comparisons that could sort six elements, from the counting bound? Give a whole number.
What is the smallest number of comparisons that could sort six elements, from the counting bound? Give a whole number.
3.[3p] Using , roughly how many comparisons are needed at minimum to sort a million elements? Give the answer in millions.
Using , roughly how many comparisons are needed at minimum to sort a million elements? Give the answer in millions.
4.[2p] The bound is always achievable, so 29 comparisons suffice to sort twelve elements.
The bound is always achievable, so 29 comparisons suffice to sort twelve elements.
5.[3p] Which of these are true of the lower bound?
Which of these are true of the lower bound?
Select all that apply
6.[2p] Counting-sorting 40 keys drawn from the range 0 to 9 costs about operations. What is that total?
Counting-sorting 40 keys drawn from the range 0 to 9 costs about operations. What is that total?
7.[3p] Radix sort would break if its per-digit pass were not stable because
Radix sort would break if its per-digit pass were not stable because
8.[3p] Put these arrays in the order radix sort produces them, starting from 213, 902, 130, 921, 013, 900.
Put these arrays in the order radix sort produces them, starting from 213, 902, 130, 921, 013, 900.
013, 130, 213, 900, 902, 921
130, 900, 921, 902, 213, 013
900, 902, 213, 013, 921, 130
Show the answer
b, a, c
9.[3p] Match each non-comparison sort to the assumption it needs.
Match each non-comparison sort to the assumption it needs.
Counting sort
Radix sort
Bucket sort
Comparison sort
nothing beyond an ordering
keys splittable into fixed-width digits
a key range small enough to index
keys spread evenly over the range
Show the answer
Counting sort: a key range small enough to index Radix sort: keys splittable into fixed-width digits Bucket sort: keys spread evenly over the range Comparison sort: nothing beyond an ordering