Programming

Saturday, June 11, 2011

Human sorting algorithms

Whilst tidying the shed, I had to stack around 100 plant pots. This is a straightforward sorting algorithm.

So why don't humans use quicksort, like computers would?

The answer which occurred to me was that the effort to compare two items is not always equal. The other answer is that humans can't keep track of umpteen piles of stuff, and remember which pile needs to be merged into another pile. Each of these things takes overhead which isn't accounted for in the traditional analysis of sorting algorithms.

When there are a small number of possible sizes, the correct algorithm should be bin-packing. Just keep n separate piles, and put each item into their pile. As the number of sizes is small, arranging them is easy.

The algorithm which I used is as follows: spread everything out and pick the biggest and put it onto the pile. Repeat. If you make a mistake, do an insertion sort. This is efficient for humans, because our eyes are great at parallel processing, and is fine for around 100 pots.

Now, how to prove that this! Another real-life problem where the correct algorithm isn't obvious, is matching socks. In this case, the problem is finding a decent way of comparing them. I would suggest using a bin-packing algorithm to start with, and going from there. At each layer in the hierarchy, pick an appropriate discriminator.

What sorting algorithms don't analyse either is the likelihood of mistakes, and the cost of correcting them!

Labels:

2 Comments:

  • I like it! I do ponder the same things when ordering/indexing/accessing CD collections, book collections, setting the table, brushing teeth while getting the kids through their morning routine etc...

    Perhaps the biggest boon in human algorithms is that they are naturally _adaptive_! If along the way we recognize that the approach stopped scaling, we modify the approach and profit.

    Sometimes, the insight comes a little late and we start over; However this is hardly as pathetic as a computer that usually doesn't even pick up on a worst case (quick) sort :)

    By Blogger Amber, at 10:24 am  

  • By Anonymous Anonymous, at 3:26 pm  

Post a Comment

<< Home