skip to main content
article

Queueing and glueing for optimal partitioning (functional pearl)

Published:04 September 2016Publication History
Skip Abstract Section

Abstract

The queueing-glueing algorithm is the nickname we give to an algorithmic pattern that provides amortised linear time solutions to a number of optimal list partition problems that have a peculiar property: at various moments we know that two of three candidate solutions could be optimal. The algorithm works by keeping a queue of lists, glueing them from one end, while chopping from the other end, hence the name. We give a formal derivation of the algorithm, and demonstrate it with several non-trivial examples.

References

  1. R. C. Backhouse. Galois connections and fixed point calculus. In R. C. Backhouse, R. Crole, and J. Gibbons, editors, Algebraic and Coalgebraic Methods in the Mathematics of Program Construction, pages 89– 148. Springer-Verlag, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. R. S. Bird. Transformational programming and the paragraph problem. Science of Computer Programming, 6(2):159–189, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. R. S. Bird. Algebraic identities for program calculation. Computer Journal, 32(2):122–126, April 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. P. Brucker. Efficient algorithms for some path partitioning problems. Discrete Applied Mathematics, 62(1-3):77–85, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. K.-M. Chung and H.-I. Lu. An optimal algorithm for the maximum-density segment problem. SIAM Journal on Computing, 34(2):373–387, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. S. Curtis and S.-C. Mu. Calculating a linear-time solution to the densestsegment problem. Journal of Functional Programming, 25, 2015.Google ScholarGoogle Scholar
  7. O. de Moor and J. Gibbons. Bridging the algorithm gap: A linear-time functional program for paragraph formatting. Science of Computer Programming, 35(1):3–27, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Z. Galil and K. Park. Dynamic programming with convexity, concavity and sparsity. Theoretical Computer Science, 92(1):49–76, January 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. M. H. Goldwasser, M.-Y. Kao, and H.-I. Lu. Linear-time algorithms for computing maximum-density sequence segments with bioinformatics applications. Journal of Computer and System Sciences, 70(2):128–144, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. R. Hinze and R. Paterson. Finger trees: a simple general-purpose data structure. Journal of Functional Programming, 16(2):197–217, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. D. S. Hirschberg and L. L. Larmore. The least weight subsequence problem. SIAM Journal on Computing, 16(4):628–638, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. R. J. M. Hughes. A novel representation of lists and its application to the function “reverse”. Information Processing Letters, 22:141–144, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. D. E. Knuth and M. F. Plass. Breaking paragraphs into lines. Software – Practice and Experience, 11(11):1119–1184, 1981.Google ScholarGoogle Scholar
  14. C. Okasaki. Purely Functional Data Structures. Cambridge University Press, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. S. van Hoesel, A. Wagelmans, and B. Moerman. Using geometric techniques to improve dynamic programming algorithms for the economic lot-sizing problem and extensions. European Journal of Operational Research, 75(2):312–331, 1994.Google ScholarGoogle ScholarCross RefCross Ref

Index Terms

  1. Queueing and glueing for optimal partitioning (functional pearl)

        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 ACM SIGPLAN Notices
          ACM SIGPLAN Notices  Volume 51, Issue 9
          ICFP '16
          September 2016
          501 pages
          ISSN:0362-1340
          EISSN:1558-1160
          DOI:10.1145/3022670
          Issue’s Table of Contents
          • cover image ACM Conferences
            ICFP 2016: Proceedings of the 21st ACM SIGPLAN International Conference on Functional Programming
            September 2016
            501 pages
            ISBN:9781450342193
            DOI:10.1145/2951913

          Copyright © 2016 ACM

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 4 September 2016

          Check for updates

          Qualifiers

          • article
        • Article Metrics

          • Downloads (Last 12 months)10
          • Downloads (Last 6 weeks)1

          Other Metrics

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!