4 ms·
Card sorters are not linear time. They're number of cards x number of columns of sort key. Sort keys, if unique, have to have size O(log N), so card sorters a
by Animats 11y ago
Card sorters are not linear time. They're number of cards x number of columns of sort key. Sort keys, if unique, have to have size O(log N), so card sorters are O(N log N), as you'd expect.
You can beat O(N log N) with a radix-like sort (SyncSort, the first software patent, shows how), but you need more bins than a card sorter has.
- ntonozzi 11y agoAnother way to look at it: Sorting is linear in the size of the input in bytes, but not item count. It's only comparison sort that happens to be O(n log n).
- GnarfGnarf 11y agoIf you have 1,000 cards and you are sorting on 6 columns, you have to pass all the cards 6 times, which means reading 6,000 cards. Is this O(N log N)? I know this because I did it for a living when I started working in 1970.