4 ms·
Yes, 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.
by kachnuv_ocasek 11y ago
Yes, 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.