Which sorting algorithm would you choose if you would be in a group of 10 people who had to mark 400 exam papers and sort them by registration number?
Which one of these would be the best?
- InsertionSort
- SelectionSort
- BubbleSort
- MergeSort
Is there even a better solution?
Since there are 10 markers, it seems natural to aim for 10-way parallelization. Splitting on the first digit might achieve this in a way that’s easy for a human to perform, although it depends on the distribution of the registration numbers whether you get an even division or not.
It’s also the first step of an MSD radix sort. Exam papers are like linked lists in that concatenating sequences is cheap (put one pile on top of another pile). So an MSD radix sort is embarrassingly parallel, easy for a human to perform, and therefore I propose a modified MSD radix sort:
I don’t think that bubble sort or merge sort are useful, they’re actually quite fiddly to do by hand. Selection sort might be worth testing against insertion sort for very small piles. In practice, a human can sort 4 objects just by looking at the numbers, mentally sorting those numbers, then putting the objects into order. You could call that selection sort.
[*] Ideally that’s the MSD of all of them put together, and you pad numbers with leading zeroes as necessary. But if you don’t know in advance how many digits a registration number can have, that’s actually quite awkward, it might require an initial pass of all 400 papers to find the maximum number. An alternative is to split the papers based on the number of digits in the registration number, and continue from there. It still works as a top-down partition, just doesn’t have the convenient division into 10 at the first step.