Sorting Quiz
Editorial
16 questions across the four Sorting lessons and the section's problems: the simple sorts and what sorted order buys; merge sort and counting while merging; quick sort, partitions and quickselect; and the sorts that don't compare. Pick an answer to see whether it's right and why. Nothing is saved, so you can take it again.
If one trips you up, its lesson is Introduction to Sorting, Merge Sort and Counting Inversions, Quick Sort and Partitioning or Counting, Bucket and Radix Sort.
Quiz
1 / 16Multiple choice
Rank Transform of an Array on [40, 10, 20, 10, 40]: what comes out?
Multiple choice
Bubble sort with the early exit: which array takes the most passes?
Multiple choice
Insertion sort on [4, 1, 3, 5, 2]: how many shifts?
Multiple choice
Selection sort orders the cards 2a 1b 2c 1d by number only. What comes out?
Multiple choice
The cards 2b 1c 2a 1a are sorted by letter, then again with a stable sort by number. What comes out?
Multiple choice
Merge sort counts inversions while it merges [3, 7] with [1, 4, 8]. How many does this merge add?
Multiple choice
How many reverse pairs, i < j with nums[i] > 2 × nums[j], does [6, 5, 3, 1] have?
Multiple choice
Bottom-up merge sort on 1,000 values: how many passes over the array?
Multiple choice
Lomuto's partition of [5, 9, 2, 7, 3, 6] around the last value: what's the array after?
Multiple choice
Three-way quick sort on 1,000 values, each from 0 to 4: how many partitions does it make?
Multiple choice
Lomuto turns [9, 4, 7, 1, 8, 2, 6] into 4 1 2 6 8 7 9, with 6 at index 3. Quickselect wants the 2nd smallest. What next?
Multiple choice
Quick sort with the last value as the pivot, on 1,000 values already in order: how many comparisons?
Multiple choice
At least how many comparisons does some order of 5 values need, for any comparison sort?
Multiple choice
Counting sort on the keys 2 0 2 1 3 0, keys 0 to 3: where does each key's run end, after the prefix sum?
Multiple choice
A radix pass walks from the left but fills each digit's run from its end. On [12, 31, 22, 11], what does the ones pass give?
Multiple choice
Maximum Gap on [5, 20, 11, 2, 18]: how wide are the buckets?