Algorithmica

, Volume 69, Issue 2, pp 294–314

Necklaces, Convolutions, and X+Y

  • David Bremner
  • Timothy M. Chan
  • Erik D. Demaine
  • Jeff Erickson
  • Ferran Hurtado
  • John Iacono
  • Stefan Langerman
  • Mihai Pǎtraşcu
  • Perouz Taslakian
Article

DOI: 10.1007/s00453-012-9734-3

Cite this article as:
Bremner, D., Chan, T.M., Demaine, E.D. et al. Algorithmica (2014) 69: 294. doi:10.1007/s00453-012-9734-3

Abstract

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 even, and p=∞. For p even, we reduce the problem to standard convolution, while for p=∞ and p=1, we reduce the problem to (min,+) convolution and \((\operatorname {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(n2) time, whereas the obvious algorithms for these problems run in Θ(n2) time.

Keywords

Necklace alignment Cyclic swap distance Convolution Sorting X+Y All pairs shortest paths 

Copyright information

© Springer Science+Business Media New York 2012

Authors and Affiliations

  • David Bremner
    • 1
  • Timothy M. Chan
    • 2
  • Erik D. Demaine
    • 3
  • Jeff Erickson
    • 4
  • Ferran Hurtado
    • 5
  • John Iacono
    • 6
  • Stefan Langerman
    • 7
  • Mihai Pǎtraşcu
    • 8
  • Perouz Taslakian
    • 9
  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.Directeur de Recherches du FRS-FNRS, Départment d’InformatiqueUniversité Libre de BruxellesBrusselsBelgium
  8. 8.AT&T Labs—ResearchFlorham ParkUSA
  9. 9.College of Science and EngineeringAmerican University of ArmeniaYerevanArmenia

Personalised recommendations