Graphs, hypergraphs and hashing

  • George Havas
  • Bohdan S. Majewski
  • Nicholas C. Wormald
  • Zbigniew J. Czech
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 790)


Minimal perfect hash functions are used for memory efficient storage and fast retrieval of items from static sets. We present an infinite family of efficient and practical algorithms for generating minimal perfect hash functions which allow an arbitrary order to be specified for the keys. We show that almost all members of the family are space and time optimal, and we identify the one with minimum constants. Members of the family generate a minimal perfect hash function in two steps. First a special kind of function into an r-graph is computed probabilistically. Then this function is refined deterministically to a minimal perfect hash function. We give strong practical and theoretical evidence that the first step uses linear random time. The second step runs in linear deterministic time. The family not only has theoretical importance, but also offers the fastest known method for generating perfect hash functions.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. A.V. Aho, J.E. Hopcroft, and J.D. Ullman. The Design and Analysis of Computer Algorithms. Addison-Wesley, 1974.Google Scholar
  2. M.D. Brain and A.L. Tharp. Near-perfect hashing of large word sets. Software — Practice and Experience 19 (1989) 967–978.Google Scholar
  3. M.D. Brain and A.L. Tharp. Perfect hashing using sparse matrix packing. Information Systems, 15 (1990) 281–290.Google Scholar
  4. J.L. Carter and M.N. Wegman. Universal classes of hash functions. In 9th Annual ACM Symposium on Theory of Computing — STOC'77, 106–112, 1977.Google Scholar
  5. J.L. Carter and M.N. Wegman. New classes and applications of hash functions. In 20th Annual Symposium on Foundations of Computer Science — FOCS'79, 175–182, 1979a.Google Scholar
  6. J.L. Carter and M.N. Wegman. Universal classes of hash functions. Journal of Computer and System Sciences, 18 (1979b) 143–154.Google Scholar
  7. N. Cercone, J. Boates, and M. Krause. An interactive system for finding perfect hash functions. IEEE Software, 2 (1985) 38–53.Google Scholar
  8. C-C. Chang and T-C. Wu. Letter oriented perfect hashing scheme based upon sparse table compression. Software — Practice and Experience, 21 (1991) 35–49.Google Scholar
  9. C.C. Chang. The study of an ordered minimal perfect hashing scheme. Communications of the ACM, 27 (1984) 384–387.Google Scholar
  10. C.C. Chang and C.H. Chang. An ordered minimal perfect hashing scheme with single parameter. Information Processing Letters, 27 (1988) 79–83.Google Scholar
  11. C.C. Chang, C.Y. Chen, and J.K. Jan. On the design of a machine independent perfect hashing. The Computer Journal, 34 (1991) 469–474.Google Scholar
  12. C.C. Chang and R.C.T. Lee. A letter-oriented minimal perfect hashing scheme. The Computer Journal, 29 (1986) 277–281.Google Scholar
  13. R.J. Cichelli. Minimal perfect hash functions made simple. Communications of the ACM, 23 (1980) 17–19.Google Scholar
  14. C.R. Cook and R.R. Oldehoeft. A letter oriented minimal perfect hashing function. SIGPLAN Notices, 17 (1982) 18–27.Google Scholar
  15. G.V. Cormack, R.N.S. Horspool, and M. Kaiserwerth. Practical perfect hashing. The Computer Journal, 28 (1985) 54–55.Google Scholar
  16. Z.J. Czech, G. Havas, and B.S. Majewski. An optimal algorithm for generating minimal perfect hash functions. Information Processing Letters, 43 (1992) 257–264.Google Scholar
  17. Z.J. Czech and B.S. Majewski. Generating a minimal perfect hashing function in O(m 2) time. Archiwum Informatyki, 4 (1992) 3–20.Google Scholar
  18. M. Dietzfelbinger, J. Gil, Y. Matias, and N. Pippenger. Polynomial hash functions are reliable. In 19th International Colloquium on Automata, Languages and Programming — ICALP'92, 235–246, Vienna, Austria, 1992. LNCS 623.Google Scholar
  19. M. Dietzfelbinger and F. Meyer auf der Heide. A new universal class of hash functions, and dynamic hashing in real time. In 17th International Colloquium on Automata, Languages and Programming — ICALP'90, 6–19, Warwick University, England, 1990. LNCS 443.Google Scholar
  20. M.W. Du, T.M. Hsieh, K.F. Jea, and D.W Shieh. The study of a new perfect hash scheme. IEEE Transactions on Software Engineering, 9 (1983) 305–313.Google Scholar
  21. R. Duke. Types of cycles in hypergraphs. Ann. Discrete Math., 27 (1985) 399–418.Google Scholar
  22. P. Erdős and A. Rényi. On the evolution of random graphs. Publ. Math. Inst. Hung. Acad. Sci., 5 (1960) 17–61. Reprinted in J.H. Spencer, editor, The Art of Counting: Selected Writings, Mathematicians of Our Time, 574–617. Cambridge, Mass.: MIT Press, 1973.Google Scholar
  23. E. Fox, Q.F. Chen, A. Daoud, and L. Heath. Order preserving minimal perfect hash functions and information retrieval. ACM Transactions on Information Systems, 9 (1991) 281–308.Google Scholar
  24. E. Fox, Q.F. Chen, and L. Heath. LEND and faster algorithms for constructing minimal perfect hash functions. In Proc. 15th Annual International ACM SIGIR Conference on Research and Development in Information Retrieval — SIGIR'92, Copenhagen, Denmark, 266–273, 1992.Google Scholar
  25. E.A. Fox, L.S. Heath, Q. Chen, and A.M. Daoud. Practical minimal perfect hash functions for large databases. Communications of the ACM, 35 (1992) 105–121.Google Scholar
  26. M.L. Fredman, J. Komlós, and E. Szemerédi. Storing a sparse table with O(1) worst case access time. Journal of the ACM, 31 (1984) 538–544.Google Scholar
  27. G.H. Gonnet and R. Baeza-Yates. Handbook of Algorithms and Data Structures. Addison-Wesley, Reading, Mass., 1991.Google Scholar
  28. M. Gori and G. Soda. An algebraic approach to Cichelli's perfect hashing. BIT, 29 (1989) 209–214.Google Scholar
  29. G. Haggard and K. Karplus. Finding minimal perfect hash functions. ACM SIGCSE Bulletin, 18 (1986) 191–193.Google Scholar
  30. G. Havas and B.S. Majewski. Optimal algorithms for minimal perfect hashing. Technical Report 234, The University of Queensland, Key Centre for Software Technology, Queensland, 1992.Google Scholar
  31. C.T.M. Jackobs and P. van Emde Boas. Two results on tables. Information Processing Letters, 22 (1986) 43–48.Google Scholar
  32. G. Jaeschke. Reciprocal hashing: A method for generating minimal perfect hashing functions. Communications of the ACM, 24 (1981) 829–833.Google Scholar
  33. A. Karlin and E. Upfal. Parallel hashing — an efficient implementation of shared memory. In 18th Annual ACM Symposium on Theory of Computing — STOC'86, 160–168, 1986.Google Scholar
  34. T.G. Lewis and C.R. Cook. Hashing for dynamic and static internal tables. Computer, 21 (1988) 45–56.Google Scholar
  35. B.S. Majewski, N.C. Wormald, Z.J. Czech, and G. Havas. A family of generators of minimal perfect hash functions. Technical Report 16, DIMACS, Rutgers University, New Jersey, USA, 1992.Google Scholar
  36. K. Mehlhorn. Data Structures and Algorithms 1: Sorting and Searching, volume 1. Springer-Verlag, Berlin Heidelberg, New York, Tokyo, 1984.Google Scholar
  37. F. Meyer auf der Heide. Dynamic hashing strategies. In 15th Symposium on Mathematical Foundations of Computer Science — MFCS'90, 76–87, Banska Bystrica, Czechoslovakia, 1990.Google Scholar
  38. P.K. Pearson. Fast hashing of variable-length text strings. Communications of the ACM, 33 (1990) 677–680.Google Scholar
  39. T.J. Sager. A polynomial time generator for minimal perfect hash functions. Communications of the ACM, 28 (1985) 523–532.Google Scholar
  40. J.P. Schmidt and A. Siegel. On aspects of universality and performance for closed hashing. In 21st Annual ACM Symposium on Theory of Computing — STOC'89, 355–366, Seattle, Washington, 1989.Google Scholar
  41. J.P. Schmidt and A. Siegel. The analysis of closed hashing under limited randomness. In 22st Annual ACM Symposium on Theory of Computing — STOC'90, 224–234, Baltimore, MD, 1990.Google Scholar
  42. J.P. Schmidt and A. Siegel. The spatial complexity of oblivious k-probe hash functions. SIAM Journal on Computing, 19 (1990) 775–786.Google Scholar
  43. A. Siegel. On universal classes of fast high performance hash functions, their timespace trade-off, and their applications. In 30th Annual Symposium on Foundations of Computer Science — FOCS'89, 20–25, 1989.Google Scholar
  44. C. Slot and P. van Emde Boas. On tape versus core: An application of space efficient hash functions to the invariance of space. In 16th Annual ACM Symposium on Theory of Computing — STOC'84, 391–400, Washington, DC, 1984.Google Scholar
  45. J. Spencer and N.C. Wormald. On the k-core of random graphs. Manuscript, 1993.Google Scholar
  46. R. Sprugnoli. Perfect hashing functions: A single probe retrieving method for static sets. Communications of the ACM, 20 (1977) 841–850.Google Scholar
  47. R.E. Tarjan and A.C-C Yao. Storing a sparse table. Communications of the ACM, 22 (1979) 606–611.Google Scholar
  48. V.G. Winters. Minimal perfect hashing for large sets of data. In International Conference on Computing and Information — ICCI'90, 275–284, Niagara Falls, Canada, 1990.Google Scholar
  49. V.G. Winters. Minimal perfect hashing in polynomial time. BIT, 30 (1990) 235–244.Google Scholar
  50. W.P. Yang and M.W. Du. A backtracking method for constructing perfect hash functions from a set of mapping functions. BIT, 25 (1985) 148–164.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1994

Authors and Affiliations

  • George Havas
    • 1
  • Bohdan S. Majewski
    • 1
  • Nicholas C. Wormald
    • 2
  • Zbigniew J. Czech
    • 3
  1. 1.Key Centre for Software Technology, Department of Computer ScienceUniversity of QueenslandQueenslandAustralia
  2. 2.Department of MathematicsUniversity of MelbourneParkvilleAustralia
  3. 3.Institutes of Computer ScienceSilesia University of Technology and Polish Academy of SciencesGliwicePoland

Personalised recommendations