3 ms·
No one owns enough socks of enough different kinds to make the accepted solution the most efficient. It's much easier to simply try for a match on an unmatched
by debacle 13y ago
No one owns enough socks of enough different kinds to make the accepted solution the most efficient.
It's much easier to simply try for a match on an unmatched sock, and if there is no match put that sock into cache (usually somewhere else on the bed). Your cache will probably never get above about 8 socks without a match.
- jameshart 13y ago"No one owns enough socks of enough different kinds" Not sure if you're making a legitimate YAGNI argument, or falling into a programmer fallacy of believing you can safely generalize from your own experience to your users... I'm leaning towards the latter, and am further going to suggest that your experience might be limited to being single, and likely male, and that it generalizes badly on any axis away from that state. This problem feels like a surprisingly good example of how your personal intuitions about a problem space can lead you to make incorrect simplifying assumptions to find an elegant solution, that will completely fail when they run into the real needs of your actual users.
- debacle 13y agoHow many different kinds of sock do you own? I fold socks for four people - my wife and my two children, contrary to your ignorant assertion - and between the four of us we may have a dozen different kinds of sock.