What sorting algorithm to sort a large number of documents for exams manually?

What sorting algorithm would you choose if you were in a group of 10 people who were supposed to mark 400 exam documents and sort them by registration number?

Which one would be the best?

  • insertion sort
  • sort by selection
  • Bubbleble
  • merger

Is there even a better solution?

+4
source share
2 answers

Since there are 10 markers, it seems natural to strive for 10-position parallelization. The division into the first digit can be achieved in such a way that a person can do this, although it depends on the distribution of registration numbers, regardless of whether you get an even division or not.

This is also the first step in sorting radix MSD. Exam documents are similar to linked lists in that concatenation sequences are cheap (put one heap on top of the other heap). Thus, MSD sorting is awkwardly parallel , easy for humans, and therefore I propose a modified MSD radius sorting:

  • Divide the documents into 10 piles by their most significant digit [*]. Assign one pile to each of 10 people.
  • Each person takes their heap and continues to sort by the MSD method. I expect that past a certain size insertion sorting becomes faster than radix sorting, and this is especially convenient for the person managing physical objects. This size can be determined in advance if you have testing time, or just leave it to people to guess. For a given size of 400 articles, the second numbering step gives an average size of 4 papers, which is undoubtedly lower than the threshold value.
  • The initial 10 piles may not be the same size, and people may not work at the same speed. Therefore, some of the 10 people will complete their pile in front of others. Fortunately, itโ€™s very easy for them to help others: just find the unsorted heap and sort it.
  • Finally, group all the piles (this is where top-down approaches such as MSD radix or quicksort have a big advantage over bottom-up approaches like LSD redix or merge).

I don't think bubble sorting or merge sorting is useful, they are actually quite inconvenient to do it manually. Sorting sorting can be worth testing against insertion sorting for very small piles. In practice, a person can sort 4 objects by simply looking at the numbers, mentally sorting these numbers, and then putting the objects in order. You can name this choice.

[*] Ideally, the MSDs of all of them are put together, and if necessary, you type numbers with leading zeros. But if you do not know in advance how many digits a registration number can have, which is actually quite inconvenient, an initial pass of all 400 documents may be required to find the maximum number. An alternative is the separation of documents based on the number of digits in the registration number and the continuation from there. It still works as the top section, it just doesnโ€™t have a convenient division by 10 in the first step.

+4
source

If I were trying to sort numbers, then I would use an algorithm called bucket sort , several times, by extracting parts of the number:

  • first run: get modulo 10 of all numbers and put them in buckects from 0 to 9;

  • second launch: get modulo 100 and divide by 10, and then put them in buckets from 0 to 9,

do it over and over to the last possible number. i.e:

  • Third time: modulo 1000 div 100

  • 4th time: modulo 10,000 div per 1000 ...

At the end, you will have 10 buckets with ordered contents inside them.

+2
source

Source: https://habr.com/ru/post/1379823/


All Articles