# Sorting a stack of cards with help of a computer

I have a physical stack of cards, with numbers on them (or, in reality, I have a stack of exams, with students names on them ;)). I want to sort the cards in ascending order.

This is an extremely boring task. I usually use mergesort myself (quick question: what do you use?). But say each card has a QR code. I can scan all the codes as I go through the stack using my mobile phone and then I have the list of cards and the order in which they appear.

What would be a clever way to use this information in order to tell a human how to sort the stack of cards? I imagine that the computer could somehow give me instructions of what to do so as to arrive at the sorted order. Notice that things like "take the 52nd card and place it on the top" are not nice, since I don't want to count to the 52nd card. What would you do?

I realize this question is rather subjective: what constitutes a "nice" strategy depends on the person. I just want to know what kinds of ideas you people could come up with.

• As you have noticed it is quite subjective task, which does not fit well to Q&A format. But let me assume you will edit the question to make it more fitting - what operations are ok? If you do not have access to $i-th$ paper, and probably you are interested in spending least time - making access hard grows in number of swaps - not very efficient tradeoff. So please define your objective. – Evil Jul 8 '16 at 23:30
• And quick answer - ask people to put papers in order of points gathered - quite good estimator. But this "strategy" fits more to chat, not as subquestion. – Evil Jul 8 '16 at 23:33
• It's a mostly ignored question - what is the fastest way to sort n items if the cost of moving an item is substantially higher than the cost of comparing two items? As an example, quicksort can be adapted by using a pivot that is not close to the median to reduce the number of moves at the cost of more comparisons. – gnasher729 Jul 9 '16 at 12:14

(repeat n times and you're ready for the parcel delivery office, almost... a railway post clerk was required to sort 600 pieces of mail in an hour with 97% accuracy in order to keep his job :-)