skip to main content
research-article

The Power of Simple Tabulation Hashing

Published:01 June 2012Publication History
Skip Abstract Section

Abstract

Randomized algorithms are often enjoyed for their simplicity, but the hash functions used to yield the desired theoretical guarantees are often neither simple nor practical. Here we show that the simplest possible tabulation hashing provides unexpectedly strong guarantees.

The scheme itself dates back to Zobrist in 1970 who used it for game playing programs. Keys are viewed as consisting of c characters. We initialize c tables H1, ..., Hc mapping characters to random hash codes. A key x = (x1, ..., xc) is hashed to H1[x1] ⊕ ⋯ ⊕ Hc[xc], where ⊕ denotes bit-wise exclusive-or.

While this scheme is not even 4-independent, we show that it provides many of the guarantees that are normally obtained via higher independence, for example, Chernoff-type concentration, min-wise hashing for estimating set intersection, and cuckoo hashing.

References

  1. Alon, N., Matias, Y., and Szegedy, M. 1999. The space complexity of approximating the frequency moments. J. Comput. Syst. Sci. 58, 1, 209--223. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Azar, Y., Broder, A. Z., Karlin, A. R., and Upfal, E. 1999. Balanced allocations. SIAM J. Comput. 29, 1, 180--200. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Braverman, V., Chung, K.-M., Liu, Z., Mitzenmacher, M., and Ostrovsky, R. 2010. AMS without 4-wise independence on product domains. In Proceedings of the 27th Symposium on Theoretical Aspects of Computer Science (STACS). 119--130.Google ScholarGoogle Scholar
  4. Broder, A. Z., Charikar, M., Frieze, A. M., and Mitzenmacher, M. 2000. Min-wise independent permutations. J. Comput. Syst. Sci. 60, 3, 630--659. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Carter, L. and Wegman, M. N. 1979. Universal classes of hash functions. J. Comput. Syst. Sci. 18, 2, 143--154.Google ScholarGoogle ScholarCross RefCross Ref
  6. Cohen, J. S. and Kane, D. M. 2009. Bounds on the independence required for cuckoo hashing. Manuscript. http://math.stanford.edu/~dankane/cuchkoohashing.pdf.Google ScholarGoogle Scholar
  7. Dietzfelbinger, M. 1996. Universal hashing and k-wise independent random variables via integer arithmetic without primes. In Proceedings of the 13th Symposium on Theoretical Aspects of Computer Science (STACS). 569--580. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Dietzfelbinger, M., and Rink, M. 2009. Applications of a splitting trick. In Proceedings of the 36th International Colloquium on Automata, Languages and Programming (ICALP). 354--365. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Dietzfelbinger, M. and Schellbach, U. 2009. On risks of using cuckoo hashing with simple universal hash classes. In Proceedings of the 20th ACM/SIAM Symposium on Discrete Algorithms (SODA). 795--804. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Dietzfelbinger, M. and Woelfel, P. 2003. Almost random graphs with simple hash functions. In Proceedings of the 25th ACM Symposium on Theory of Computing (STOC). 629--638. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Dietzfelbinger, M., Hagerup, T., Katajainen, J., and Penttonen, M. 1997. A reliable randomized algorithm for the closest-pair problem. J. Algor. 25, 1, 19--51. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Gerber, L. 1968. An extension of Bernoulli’s inequality. Amer. Math. Month. 75, 875--876.Google ScholarGoogle ScholarCross RefCross Ref
  13. Indyk, P. 2001. A small approximately min-wise independent family of hash functions. J. Algor. 38, 1, 84--90. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Karloff, H. J. and Raghavan, P. 1993. Randomized algorithms and pseudorandom numbers. J. ACM 40, 3, 454--476. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Knuth, D. E. 1963. Notes on open addressing. Unpublished memorandum. http://citeseer.ist.psu.edu/knuth63notes.html.Google ScholarGoogle Scholar
  16. Mitzenmacher, M., and Vadhan, S. P. 2008. Why simple hash functions work: exploiting the entropy in a data stream. In Proceedings of the 19th ACM/SIAM Symposium on Discrete Algorithms (SODA). 746--755. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Motwani, R. and Raghavan, P. 1995. Randomized Algorithms. Cambridge University Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Pagh, A., Pagh, R., and Ružić, M. 2009. Linear probing with constant independence. SIAM J. Comput. 39, 3, 1107--1120. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Pagh, R., and Rodler, F. F. 2004. Cuckoo hashing. J. Algor. 51, 2, 122--144. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Pǎtraşcu, M., and Thorup, M. 2010. On the k-independence required by linear probing and minwise independence. In Proceedings of the 37th International Colloquium on Automata, Languages and Programming (ICALP). 715--726. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Schmidt, J. P., Siegel, A., and Srinivasan, A. 1995. Chernoff-Hoeffding bounds for applications with limited independence. SIAM J. Discr. Math. 8, 2, 223--250. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Siegel, A. 2004. On universal classes of extremely random constant-time hash functions. SIAM J. Comput. 33, 3, 505--543. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Thorup, M. 2000. Even strongly universal hashing is pretty fast. In Proceedings of the 11th ACM/SIAM Symposium on Discrete Algorithms (SODA). 496--497. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Thorup, M. 2009. String hashing for linear probing. In Proceedings of the 20th ACM/SIAM Symposium on Discrete Algorithms (SODA). 655--664. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Thorup, M., and Zhang, Y. 2012. Tabulation-based 5-independent hashing with applications to linear probing and second moment estimation. SIAM J. Comput. 41, 2, 293--331. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Wegman, M. N., and Carter, L. 1981. New classes and applications of hash functions. J. Comput. Syst. Sci. 22, 3, 265--279.Google ScholarGoogle ScholarCross RefCross Ref
  27. Zobrist, A. L. 1970. A new hashing method with application for game playing. Tech. rep. 88, Computer Sciences Department, University of Wisconsin, Madison, WI.Google ScholarGoogle Scholar

Index Terms

  1. The Power of Simple Tabulation Hashing

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        • Published in

          cover image Journal of the ACM
          Journal of the ACM  Volume 59, Issue 3
          June 2012
          180 pages
          ISSN:0004-5411
          EISSN:1557-735X
          DOI:10.1145/2220357
          Issue’s Table of Contents

          Copyright © 2012 ACM

          Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 1 June 2012
          • Accepted: 1 March 2012
          • Revised: 1 November 2011
          • Received: 1 June 2011
          Published in jacm Volume 59, Issue 3

          Permissions

          Request permissions about this article.

          Request Permissions

          Check for updates

          Qualifiers

          • research-article
          • Research
          • Refereed

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader