World's most popular travel blog for travel bloggers.

[Solved]: Sorting a stack of cards with help of a computer

, , No Comments
Problem Detail: 

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.

Asked By : Fernando

Answered By : manlio

  1. Setup an array of initially empty file folders (even better buy a mail sorter and you are in the pigeonhole sort case).
  2. The computer, knowing the initial order of the cards, will tell you, one by one, where to put each card (you have a limited number of folders so instructions like "take the current card and place it on top / bottom of folder 3" are quite easy to follow).
  3. Manually sort each non empty folder using insertion-sort.
  4. Visit the folders in order and put all cards back onto the table.

(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 :-)

Best Answer from StackOverflow

Question Source :

3.2K people like this

 Download Related Notes/Documents


Post a Comment

Let us know your responses and feedback