Necklaces, Convolutions, and X + Y

Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4168)


We give subquadratic algorithms that, given two necklaces each with n beads at arbitrary positions, compute the optimal rotation of the necklaces to best align the beads. Here alignment is measured according to the ℓ p norm of the vector of distances between pairs of beads from opposite necklaces in the best perfect matching. We show surprisingly different results for p=1, p=2, and p=∞. For p=2, we reduce the problem to standard convolution, while for p=∞ and p=1, we reduce the problem to (min,+) convolution and (median,+) convolution. Then we solve the latter two convolution problems in subquadratic time, which are interesting results in their own right. These results shed some light on the classic sorting X + Y problem, because the convolutions can be viewed as computing order statistics on the antidiagonals of the X + Y matrix. All of our algorithms run in o(n 2) time, whereas the obvious algorithms for these problems run in Θ(n 2) time.


Time Algorithm Decision Tree Model Median Element Asymptotic Number Circular Distance 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Baran, I., Demaine, E.D., Pǎtraşcu, M.: Subquadratic algorithms for 3SUM. In: Dehne, F., López-Ortiz, A., Sack, J.-R. (eds.) WADS 2005. LNCS, vol. 3608, pp. 409–421. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  2. 2.
    Bellman, R., Karush, W.: Mathematical programming and the maximum transform. J. SIAM 10(3), 550–567 (1962)zbMATHMathSciNetGoogle Scholar
  3. 3.
    Bernstein, D.J.: Fast multiplication and its applications. In: Buhler, J., Stevenhagen, P. (eds.) Algorithmic Number Theory. Cambridge University Press, Cambridge (to appear)Google Scholar
  4. 4.
    Bussieck, M., Hassler, H., Woeginger, G.J., Zimmermann, U.T.: Fast algorithms for the maximum convolution problem. Oper. Res. Lett. 15(3), 133–141 (1994)zbMATHCrossRefMathSciNetGoogle Scholar
  5. 5.
    Cardinal, J., Kremer, S., Langerman, S.: Juggling with pattern matching. Theory Comput. Syst. 39(3), 425–437 (2006)zbMATHCrossRefMathSciNetGoogle Scholar
  6. 6.
    Chan, T.M.: All-pairs shortest paths with real weights in O(n 3/logn) time. In: Dehne, F., López-Ortiz, A., Sack, J.-R. (eds.) WADS 2005. LNCS, vol. 3608, pp. 318–324. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  7. 7.
    Cohn, H., Kleinberg, R., Szegedy, B., Umans, C.: Group-theoretic algorithms for matrix multiplication. In: Proc. 46th IEEE Symp. Found. Computer Science, pp. 379–388 (2005)Google Scholar
  8. 8.
    Colannino, J., Damian, M., Hurtado, F., Iacono, J., Meijer, H., Ramaswami, S., Toussaint, G.: An O(n logn)-time algorithm for the restriction scaffold assignment. J. Comput. Biol. 13(4), 979–989 (2006)CrossRefMathSciNetGoogle Scholar
  9. 9.
    Cole, R., Hariharan, R.: Verifying candidate matches in sparse and wildcard matching. In: Proc. 34th ACM Symp. Theory of Computing, pp. 592–601 (2002)Google Scholar
  10. 10.
    Cooley, J.W., Tukey, J.W.: An algorithm for the machine calculation of complex Fourier series. Math. Comp. 19, 297–301 (1965)zbMATHCrossRefMathSciNetGoogle Scholar
  11. 11.
    Cormen, T.H., Leiserson, C.E., Rivest, R.L., Stein, C.: Introduction to Algorithms, 2nd edn. MIT Press, Cambridge (2001)zbMATHGoogle Scholar
  12. 12.
    Demaine, E.D., Mitchell, J.S.B., O’Rourke, J.: Problem 41: Sorting X + Y (pairwise sums). In: The Open Problems Project,
  13. 13.
    Demaine, E.D., O’Rourke, J.: Open problems from CCCG 2005. In: Proc. 18th Canadian Conference on Computational Geometry (2006)Google Scholar
  14. 14.
    Díaz-Báñez, J.M., Farigu, G., Gómez, F., Rappaport, D., Toussaint, G.T.: El compás flamenco: A phylogenetic analysis. In: Proc. BRIDGES: Mathematical Connections in Art, Music, and Science, pp. 61–70 (2004)Google Scholar
  15. 15.
    Erickson, J.: Lower bounds for linear satisfiability problems. Chic. J. Theoret. Comput. Sci. (1999)Google Scholar
  16. 16.
    Felzenszwalb, P.F., Huttenlocher, D.P.: Distance transforms of sampled functions. TR2004-1963, Faculty of Computing and Information Science, Cornell UnivGoogle Scholar
  17. 17.
    Fischer, M.J., Paterson, M.S.: String-matching and other products. In: Proc. SIAM-AMS Applied Math. Symp. Complexity of computation, pp. 113–125 (1973)Google Scholar
  18. 18.
    Frederickson, G.N., Johnson, D.B.: The complexity of selection and ranking in X + Y and matrices with sorted columns. J. Comput. System Sci. 24(2), 197–208 (1982)zbMATHCrossRefMathSciNetGoogle Scholar
  19. 19.
    Fredman, M.L.: How good is the information theory bound in sorting? Theoret. Comput. Sci. 1(4), 355–361 (1976)zbMATHCrossRefMathSciNetGoogle Scholar
  20. 20.
    Fredman, M.L.: New bounds on the complexity of the shortest path problem. SIAM J. Comput. 5(1), 83–89 (1976)zbMATHCrossRefMathSciNetGoogle Scholar
  21. 21.
    Gauss, C.F.: Werke, Königlichen Gesellschaft der Wissenschaften, vol. 3 (1866)Google Scholar
  22. 22.
    Heideman, M.T., Johnson, D.H., Burrus, C.S.: Gauss and the history of the fast Fourier transform. Arch. Hist. Exact Sci. 34(3), 265–277 (1985)zbMATHCrossRefMathSciNetGoogle Scholar
  23. 23.
    Indyk, P.: Faster algorithms for string matching problems: Matching the convolution bound. In: Proc. 39th Symp. Found. Computer Science, pp. 166–173 (1998)Google Scholar
  24. 24.
    Maragos, P.: Differential morphology. In: Mitra, S., Sicuranza, G. (eds.) Nonlinear Image Processing, Ch. 10, pp. 289–329. Academic Press, London (2000)Google Scholar
  25. 25.
    Moreau, J.-J.: Inf-convolution, sous-additivité, convexité des fonctions numériques. J. Math. Pures Appl. 49(9), 109–154 (1970)zbMATHMathSciNetGoogle Scholar
  26. 26.
    Rockafellar, R.T.: Convex Analysis. Princeton University Press, Princeton (1970)zbMATHGoogle Scholar
  27. 27.
    Steiger, W.L., Streinu, I.: A pseudo-algorithmic separation of lines from pseudo-lines. Infor. Process. Lett. 53(5), 295–299 (1995)zbMATHCrossRefMathSciNetGoogle Scholar
  28. 28.
    Strömberg, T.: The operation of infimal convolution. Dissertationes Math. (Rozprawy Mat.) 352, 58 (1996)MathSciNetGoogle Scholar
  29. 29.
    Toussaint, G.: The geometry of musical rhythm. In: Akiyama, J., Kano, M., Tan, X. (eds.) JCDCG 2004. LNCS, vol. 3742, pp. 198–212. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  30. 30.
    Toussaint, G.T.: A comparison of rhythmic similarity measures. In: Proc. 5th International Conference on Music Information Retrieval, pp. 242–245 (2004)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  1. 1.Faculty of Computer ScienceUniversity of New BrunswickFrederictonCanada
  2. 2.School of Computer ScienceUniversity of WaterlooWaterlooCanada
  3. 3.Computer Science and Artificial Intelligence LaboratoryMassachusetts Institute of TechnologyCambridgeUSA
  4. 4.Computer Science DepartmentUniversity of IllinoisUrbana-ChampaignUSA
  5. 5.Departament de Matemàtica Aplicada IIUniversitat Politècnica de CatalunyaBarcelonaSpain
  6. 6.Department of Computer and Information SciencePolytechnic UniversityBrooklynUSA
  7. 7.Chercheur qualifié du FNRS, Départment d’InformatiqueUniversité Libre de BruxellesBrusselsBelgium
  8. 8.School of Computer ScienceMcGill UniversityMontréalCanada

Personalised recommendations