Matching nuts and bolts faster

  • Phillip G. Bradford
  • Rudolf Fleischer
Session 11B
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1004)


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 log4n) time. Their solution uses (efficient) graph expanders. In this paper, we give a simpler O(n log2n) time algorithm which uses only a simple (and not so efficient) expander.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    N. Alon. Personal communication, 1995.Google Scholar
  2. 2.
    N. Alon, M. Blum, A. Fiat, S. Kannan, M. Naor and R. Ostrovsky. Matching nuts and bolts. Proceedings of the 5th Annual ACM-SIAM Symposium on Discrete Algorithms (SODA'94), 1994, pp. 690–696.Google Scholar
  3. 3.
    N. Alon, Z. Galil and V.D. Milman. Better expanders and superconcentrators. Journal of Algorithms 8 (1987), pp. 337–347.Google Scholar
  4. 4.
    N. Alon and J. Spencer. The Probabilistic Method. John Wiley and Sons Inc., New York, 1992.Google Scholar
  5. 5.
    T.H. Cormen, C.E. Leiserson and R.L. Rivest. Introduction to algorithms. MIT Press, 1990.Google Scholar
  6. 6.
    W. Goddard, C. Kenyon, V. King and L. Schulman. Optimal randomized algorithms for local sorting and set-maxima. SIAM Journal on Computing 22, 1993, pp. 272–283.Google Scholar
  7. 7.
    J. Komlós, Y. Ma and E. Szemerédi. Matching nuts and bolts in O(n log n) time. Personal communication, Yuan Ma, 1995.Google Scholar
  8. 8.
    A. Lubotzky. Discrete groups, expanding graphs and invariant measures. Birkhäuser Verlag, 1994.Google Scholar
  9. 9.
    A. Lubotzky, R. Phillips and P. Sarnak. Explicit expanders and the Ramanujan conjectures. Proceedings of the 18th ACM STOC, 1986, pp. 240–246.Google Scholar
  10. 9a.
    See also: A. Lubotzky, R. Phillips and P. Sarnak. Ramanujan graphs. Combinatorica 8 (1988), pp. 261–277.Google Scholar
  11. 10.
    G.A. Margulis. Explicit group-theoretical constructions of combinatorial schemes and their application to the design of expanders and superconcentrators. Problemy Peredachi Informatsii 24 (1988), pp. 51–60 (in Russian). English translation in Problems of Information Transmission 24 (1988), pp. 39–46.Google Scholar
  12. 11.
    J.I. Munro and M. Paterson. Selection and sorting with limited storage. Theoretical Computer Science 12, 1980, pp. 315–323.Google Scholar
  13. 12.
    G.J.E. Rawlins. Compared to what? An introduction to the analysis of algorithms. Computer Science Press, 1992.Google Scholar

Copyright information

© Springer-Verlag 1995

Authors and Affiliations

  • Phillip G. Bradford
    • 1
  • Rudolf Fleischer
    • 1
  1. 1.Max-Planck-Institut für InformatikSaarbrückenGermany

Personalised recommendations