Document Open Access Logo

Hamming Distance Completeness

Authors Karim Labib, Przemysław Uznański, Daniel Wolleb-Graf

Thumbnail PDF


  • Filesize: 0.66 MB
  • 17 pages

Document Identifiers

Author Details

Karim Labib
  • Google Zürich, Switzerland
Przemysław Uznański
  • Institute of Computer Science, University of Wrocław, Poland
Daniel Wolleb-Graf
  • Department of Computer Science, ETH Zürich, Switzerland

Cite AsGet BibTex

Karim Labib, Przemysław Uznański, and Daniel Wolleb-Graf. Hamming Distance Completeness. In 30th Annual Symposium on Combinatorial Pattern Matching (CPM 2019). Leibniz International Proceedings in Informatics (LIPIcs), Volume 128, pp. 14:1-14:17, Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2019)


We show, given a binary integer function diamond that is piecewise polynomial, that (+,diamond) vector products are equivalent under one-to-polylog reductions to the computation of the Hamming distance. Examples include the dominance and l_{2p+1} distances for constant p. Our results imply equivalence (up to polylog factors) between the complexity of computing All Pairs Hamming Distance, All Pairs l_{2p+1} Distance and Dominance Matrix Product, and equivalence between Hamming Distance Pattern Matching, l_{2p+1} Pattern Matching and Less-Than Pattern Matching. The resulting algorithms for l_{2p+1} Pattern Matching and All Pairs l_{2p+1}, for 2p+1 = 3,5,7,... are likely to be optimal, given lack of progress in improving upper bounds for Hamming distance in the past 30 years. While reductions between selected pairs of products were presented in the past, our work is the first to generalize them to a general class of functions, showing that a wide class of "intermediate" complexity problems are in fact equivalent.

Subject Classification

ACM Subject Classification
  • Theory of computation → Design and analysis of algorithms
  • fine grained complexity
  • approximate pattern matching
  • matrix products


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Karl R. Abrahamson. Generalized String Matching. SIAM J. Comput., 16(6):1039-1051, 1987. Google Scholar
  2. Amihood Amir and Martin Farach. Efficient matching of nonrectangular shapes. Annals of Mathematics and Artificial Intelligence, 4(3):211-224, September 1991. URL:
  3. Amihood Amir, Ohad Lipsky, Ely Porat, and Julia Umanski. Approximate Matching in the L₁ Metric. In CPM, pages 91-103, 2005. URL:
  4. Mikhail J. Atallah. Faster image template matching in the sum of the absolute value of differences measure. IEEE Trans. Image Processing, 10(4):659-663, 2001. URL:
  5. Mikhail J. Atallah and Timothy W. Duket. Pattern matching in the Hamming distance with thresholds. Inf. Process. Lett., 111(14):674-677, 2011. URL:
  6. Keren Censor-Hillel, Dean Leitersdorf, and Elia Turner. Sparse Matrix Multiplication and Triangle Listing in the Congested Clique Model. In OPODIS 2018, pages 4:1-4:17, 2018. URL:
  7. Peter Clifford and Raphaël Clifford. Simple deterministic wildcard matching. Inf. Process. Lett., 101(2):53-54, 2007. URL:
  8. Peter Clifford, Raphaël Clifford, and Costas S. Iliopoulos. Faster Algorithms for δ,γ-Matching and Related Problems. In CPM, pages 68-78, 2005. URL:
  9. Marek Cygan, Marcin Mucha, Karol Wegrzycki, and Michal Wlodarczyk. On Problems Equivalent to (min, +)-Convolution. In ICALP, pages 22:1-22:15, 2017. URL:
  10. Ran Duan and Seth Pettie. Fast algorithms for (max, min)-matrix multiplication and bottleneck shortest paths. In SODA, pages 384-391, 2009. URL:
  11. François Le Gall. Faster Algorithms for Rectangular Matrix Multiplication. In FOCS, pages 514-523, 2012. URL:
  12. Francois Le Gall and Florent Urrutia. Improved Rectangular Matrix Multiplication using Powers of the Coppersmith-Winograd Tensor. In SODA, pages 1029-1046, 2018. URL:
  13. Paweł Gawrychowski and Przemysław Uznański. Towards Unified Approximate Pattern Matching for Hamming and L_1 Distance. In ICALP 2018, pages 62:1-62:13, 2018. URL:
  14. Omer Gold and Micha Sharir. Dominance Product and High-Dimensional Closest Pair under L_∞. In ISAAC, pages 39:1-39:12, 2017. URL:
  15. Daniel Graf, Karim Labib, and Przemysław Uznański. Hamming distance completeness and sparse matrix multiplication. CoRR, abs/1711.03887, 2017. URL:
  16. Sariel Har-Peled, Piotr Indyk, and Rajeev Motwani. Approximate Nearest Neighbor: Towards Removing the Curse of Dimensionality. Theory of Computing, 8(1):321-350, 2012. URL:
  17. Piotr Indyk, Moshe Lewenstein, Ohad Lipsky, and Ely Porat. Closest Pair Problems in Very High Dimensions. In ICALP, pages 782-792, 2004. URL:
  18. Eamonn J. Keogh and Abdullah Mueen. Curse of Dimensionality. In Claude Sammut and Geoffrey I. Webb, editors, Encyclopedia of Machine Learning and Data Mining, pages 314-315. Springer, 2017. URL:
  19. Marvin Künnemann, Ramamohan Paturi, and Stefan Schneider. On the Fine-Grained Complexity of One-Dimensional Dynamic Programming. In ICALP 2017, pages 21:1-21:15, 2017. URL:
  20. François Le Gall. Powers of Tensors and Fast Matrix Multiplication. In ISSAC, pages 296-303, 2014. URL:
  21. Ohad Lipsky. Eficient Distance Computations. Master’s thesis, Bar-Ilan University. Department of Mathematics and Computer Science., 2003. Google Scholar
  22. Ohad Lipsky and Ely Porat. L₁ pattern matching lower bound. Inf. Process. Lett., 105(4):141-143, 2008. URL:
  23. Ohad Lipsky and Ely Porat. Approximate Pattern Matching with the L₁, L₂ and L_∞ Metrics. Algorithmica, 60(2):335-348, 2011. URL:
  24. Jiří Matoušek. Computing Dominances in Eⁿ (Short Communication). Inf. Process. Lett., 38(5):277-278, June 1991. URL:
  25. Kerui Min, Ming-Yang Kao, and Hong Zhu. The Closest Pair Problem under the Hamming Metric. In COCOON, pages 205-214, 2009. URL:
  26. Virginia Vassilevska. Efficient algorithms for path problems in weighted graphs. PhD thesis, Carnegie Mellon University, 2008. Google Scholar
  27. Virginia Vassilevska and Ryan Williams. Finding a Maximum Weight Triangle in n^3 - δ Time, with Applications. In STOC, pages 225-231, 2006. URL:
  28. Virginia Vassilevska, Ryan Williams, and Raphael Yuster. All Pairs Bottleneck Paths and Max-Min Matrix Products in Truly Subcubic Time. Theory of Computing, 5(1):173-189, 2009. URL:
  29. Ryan Williams. On the Difference Between Closest, Furthest, and Orthogonal Pairs: Nearly-Linear vs Barely-Subquadratic Complexity. In SODA, pages 1207-1215, 2018. URL:
  30. Virginia Vassilevska Williams and Ryan Williams. Subcubic Equivalences between Path, Matrix and Triangle Problems. In FOCS 2010, pages 645-654, 2010. URL:
  31. Virginia Vassilevska Williams and Ryan Williams. Finding, Minimizing, and Counting Weighted Subgraphs. SIAM J. Comput., 42(3):831-854, 2013. URL:
  32. Raphael Yuster. Efficient algorithms on sets of permutations, dominance, and real-weighted APSP. In SODA, pages 950-957, 2009. URL:
  33. Peng Zhang and Mikhail J. Atallah. On approximate pattern matching with thresholds. Inf. Process. Lett., 123:21-26, 2017. URL:
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail