Re:The xkcd survey
by kenbellows on Wednesday September 02, 2015 @01:09PM
(#10160608)
I 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
Re:The xkcd survey
by brianwawok on Wednesday September 02, 2015 @01:53PM
(#10160898)
Exactly 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.
Intuitively 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.
Of course, there's an enlightening stackoverflow question on this: http://stackoverflow.com/q/14415881/220347
Finally, my graduate-level algorithms class comes in handy in real life.
Of course, homogeneity makes this even faster, but you lose the benefit of choice, variability and fashionableness. Quid pro quo.