3 ms·
The first answer is kind of labourous, isn't? I thought about simply removing a sock from the pile and isolating it. One for one, maybe puting the man's socks
by soneca 13y ago
The first answer is kind of labourous, isn't?
I thought about simply removing a sock from the pile and isolating it. One for one, maybe puting the man's socks on the left and the women's on the right.
So everytime you grab a new sock you can quickly check if you already isolated the pair of that one.
This way you just have to grab each sock once. (this is similar to the second answer, but no need to prepare a flat pile to begin with).
- prawks 13y agoYup. Unless you have millions of socks, you can afford to "hash" each style sock by color + pattern + size + whatever, rather than repeatedly into ever-smaller piles based on just one of the metrics. That's actually how I pair my socks from the laundry pile, anything else seems kind of silly... This kind of recursive hash partitioning is actually being done by SQL Server when it needs to hash join or hash aggregate over huge data sets. My pile of socks is not a huge dataset. They easily fit on the seat of my couch when laid out in pairs.