algorithm - Pair socks from a pile efficiently? - Stack Overflow
Given a pile of n
pairs of socks, containing 2n
elements (assume each sock has exactly one matching pair), what is the best way to pair them up efficiently with up to logarithmic extra space? (I believe I can remember that amount of info if needed.)
Read full article from algorithm - Pair socks from a pile efficiently? - Stack Overflow