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 explicit deterministic algorithm to date is due to Alon et al. (1994) and takes Θ(n log4) time. In this paper, we give a simpler O(n log2 n) time algorithm. The existence of an O (n log n) time algorithm has been proved recently (Bradford, 1995; Komlós et al., 1996).
All Science Journal Classification (ASJC) codes
- Theoretical Computer Science
- Signal Processing
- Information Systems
- Computer Science Applications
- Analysis of algorithms
- Nuts and bolts