‘How to Pair Socks From a Pile Efficiently?’


Amit on Stack Overflow asks: 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? What a great question and the answers don’t disappoint. Of course the easiest way to […]

Published by Ben Brooks