# Item

ITEM ACTIONSEXPORT

Released

Report

#### Matching nuts and bolts optimally

##### MPS-Authors

##### Locator

There are no locators available

##### Fulltext (public)

MPI-I-95-1-025.pdf

(Any fulltext), 167KB

##### Supplementary Material (public)

There is no public supplementary material available

##### Citation

Bradford, P. G.(1995). *Matching nuts and bolts optimally*
(MPI-I-1995-1-025). Saarbrücken: Max-Planck-Institut für Informatik.

Cite as: http://hdl.handle.net/11858/00-001M-0000-0014-A1DB-4

##### Abstract

The nuts and bolts problem is the following :
Given a collection of $n$ nuts of distinct sizes and $n$ bolts of distinct
sizes such that for each nut there is exactly one matching bolt,
find for each nut its corresponding bolt subject
to the restriction that we can {\em 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 quite difficult to solve.
In this paper, we illustrate the existence of an algorithm
for solving the nuts and bolts problem that makes
$O(n \lg n)$ nut-and-bolt comparisons.
We show the existence of this algorithm by showing
the existence of certain expander-based comparator networks.
Our algorithm is asymptotically optimal in terms of the number
of nut-and-bolt comparisons it does.
Another view of this result is that we show the existence of a
decision tree with depth $O(n \lg n)$ that solves this problem.