Matching nuts and bolts

We describe a procedure which may be helpful to any disorganized carpenter who has a mixed pile of bolts and nuts and wants to find the corresponding pairs of bolts and nuts. The procedure uses our (and the carpenter’s) ability to construct efficiently highly expanding graphs. The problem considered is given a collection of n bolts of distinct widths and n nuts such that there is a 1-1 correspondence between the nuts and bolts. The goal is to find for each bolt its corresponding nut by comparing nuts to bolts but not nuts to nuts or bolts to bolts. Our objective is to minimize the number of operations of this kind (as well as the total running time). The problem has a randomized algorithm similar to Quicksort. Our main result is an n(log n)O(1)∗Department of Mathematics, Raymond and Beverly Sackler Faculty of Exact Sciences, Tel Aviv University, Tel Aviv, Israel and AT & T Bell Labs, Murray Hill, NJ 07974, USA. e-mail: noga@math.tau.ac.il. Research supported in part by a United States Israel BSF Grant †Computer Science Division, University of California at Berkeley, Berkeley, CA 94720, USA. e-mail: blum@cs.berkeley.edu. Supported by NSF grant CCR92-01092. ‡Department of Computer Science, Raymond and Beverly Sackler Faculty of Exact Sciences, Tel Aviv University, Tel Aviv, Israel. e-mail: fiat@math.tau.ac.il. Research supported by a grant from the Israeli Academy of Sciences §Department of Computer Science, University of Arizona, USA. e-mail: kannan@cs.arizona.edu. ¶Department of Applied Mathematics and Computer Science, The Weizmann Institute of Science, Rehovot 76100, Israel. e-mail: naor@wisdom.weizmann.ac.il. Supported by an Alon Fellowship. ‖University of California at Berkeley Computer Science Division, and International Computer Science Institute at Berkeley. e-mail: rafail@melody.berkeley.edu. Supported by NSF postdoctoral fellowship and ICSI. Part of this work was done while visiting Tel Aviv University and Hebrew University of Jerusalem. time deterministic algorithm, based on expander graphs, for matching the bolts and the nuts.

[1]  Gregory J. E. Rawlins Compared to what? - an introduction to the analysis of algorithms , 1992, Principles of computer science series.

[2]  Alexander Lubotzky,et al.  Explicit expanders and the Ramanujan conjectures , 1986, STOC '86.

[3]  G. G. Stokes "J." , 1890, The New Yale Book of Quotations.

[4]  Wayne Goddard,et al.  Optimal randomized algorithms for local sorting and set-maxima , 1990, STOC '90.

[5]  Noga Alon,et al.  Explicit construction of linear sized tolerant networks , 1988, Discret. Math..

[6]  J. Ian Munro,et al.  Selection and sorting with limited storage , 1978, 19th Annual Symposium on Foundations of Computer Science (sfcs 1978).

[7]  B. Bollobás,et al.  Graphs whose every transitive orientation contains almost every relation , 1987 .

[8]  Noga Alon,et al.  The Probabilistic Method , 2015, Fundamentals of Ramsey Theory.

[9]  M. Murty Ramanujan Graphs , 1965 .

[10]  János Komlós,et al.  Almost Sorting in one Round , 1989, Adv. Comput. Res..

[11]  Wayne Goddard,et al.  Optimal Randomized Algorithms for Local Sorting and Set-Maxima , 1993, SIAM J. Comput..

[12]  Noga Alon,et al.  Parallel comparison algorithms for approximation problems , 1991, Comb..

[13]  Noga Alon,et al.  Finding an Approximate Maximum , 1989, SIAM J. Comput..

[14]  Nicholas Pippenger,et al.  Sorting and Selecting in Rounds , 1987, SIAM J. Comput..