5 ms·
>I have to match socks between several different styles Do I understand correctly that you throw all your socks into a drawer/container, and when you need a pai
by kachnuv_ocasek 11y ago
>I have to match socks between several different styles
Do I understand correctly that you throw all your socks into a drawer/container, and when you need a pair, you go and have to find two matching ones?
This may be cultural (or even familial) thing, but I always curl two socks up into a ball so that they stay together. When I need a pair, I just take one ball, uncurl it, and voila.
- brianwawok 11y agoBut do you curl matching socks or not? If you have many different styles, you need to go hunt around and find matches. Curl or not just delays the matching problem, it does not solve it. Having all the socks be the same makes matching an O(1) problem.
- Gravityloss 11y agobut if you curl them after drying, you have a much smaller pool to find the pair from, the just washed socks (which will be the socks you use the most anyway). So it's faster that way, than to mix them all up and only then match.
- gknoy 11y agoMy wife has about twenty pairs of socks, and no more than a few of the pairs are the same variety. It's like some masochistic combinatorics problem every single time I fold socks. My kid and I literally were playing "sock go fish" a few times to get him to help (except ... I was more interested in the pairing, rather than taking turns. Doh.) Laundry-folding happiness is increased significantly when I don't have to play "Find-the-mate" every time I pick up a sock (which applies to my kids' socks as well, since they are all patterned, but thankfully my son likes wearing party-colored socks, so I only need to match on shape). I have two "vintages" of socks -- the old ones that I hate, and the newer ones that I prefer, roughly equally divided. I would donate + re-buy if I had more than two flavors of socks.
- thumbtackthief 11y agoSock go-fish is _genius_
- cortesoft 11y agoI pretend I am a computer doing a matching problem. I have a buffer of unmatched socks that I compare each sock as I pull it out of the pile, and if unmatched I add to the buffer. Kinda fun.
- kachnuv_ocasek 11y agoYes, I pair them after washing, and curl them after drying. Putting them together makes searching O(n) instead of O(n^2) if you have a particular style in mind. Of course, homogeneity makes this even faster, but you lose the benefit of choice, variability and fashionableness. Quid pro quo.
- kenbellows 11y agoI think his point was that if you're seeking out all the pairs when you curl them together, you're still spending unnecessary time and effort matching socks, just ahead of time instead of in the moment when you need socks
- brianwawok 11y agoExactly he does an O(N^2) Pair followed by a later O(N) search. Why not do a O(1) Pair folloed by an O(1) Search.
- dtparr 11y agoOf course, there's an enlightening stackoverflow question on this: http://stackoverflow.com/q/14415881/220347 http://stackoverflow.com/q/14415881/220347 Finally, my graduate-level algorithms class comes in handy in real life.
- djfm 11y agoIntuitively I'd say a human pairing socks is far better than O(n2) because finding something that matches a given sock is close to O(1) on small sets.