Sort cards with a needle
Show on a big screenPaper cards with holes along the edge were once sorted by hand. A needle went through one hole. One trip of the needle is a pass.
- Start: D, A, C, B. Each card shows its code.
- Pass 1: split by the 1 hole. Shut-hole cards go in front.
- Pass 2: split by the 2 hole. Same rule.
- Pass 3: split by the 4 hole. Now A, B, C, D.
The rule
Sort by the 1 hole first and the 16 hole last. Put the open-hole pile behind.
All the cards together are a deck. Push a needle through one hole. Cards with that hole open fall out. The cards with it shut stay on the needle. A shut hole has a rim that holds the needle. That splits the deck into two piles.
Keep each pile in the order it had. Put the shut pile in front. Then use the next hole.
These four cards use three holes, so they needed three passes. Five holes take five passes at most. One pass per hole sorts any deck.
Watch out!
Starting with the 16 hole can leave cards out of order. The last pass counts most, so it must use the biggest place.
Tap the holes in an order. Sort the deck.
Loading lab…
Try the lab to finish this lesson.