Matching nuts and bolts faster

* Final gross prices may vary according to local VAT.

Get Access

Abstract

The problem of matching nuts and bolts is the following: Given a collection of n nuts of distinct sizes and n bolts such that there is a one-to-one correspondence between the nuts and the bolts, find for each nut its corresponding bolt. We can only compare nuts to bolts. That is we can neither compare nuts to nuts, nor bolts to bolts. This humble restriction on the comparisons appears to make this problem very hard to solve. In fact, the best deterministic solution published to date is due to Alon et al. [2] and takes θ(n log4 n) time. Their solution uses (efficient) graph expanders. In this paper, we give a simpler O(n log2 n) time algorithm which uses only a simple (and not so efficient) expander.