C implementation of the Karmarkar-Karp differencing algorithm with write-up