skip to main content
article
Free Access

Practical in-place merging

Published:01 March 1988Publication History
Skip Abstract Section

Abstract

We present a novel, yet straightforward linear-time algorithm for merging two sorted lists in a fixed amount of additional space. Constant of proportionality estimates and empirical testing reveal that this procedure is reasonably competitive with merge routines free to squander unbounded additional memory, making it particularly attractive whenever space is a critical resource.

References

  1. 1 Alanko, T.O., Erkio, H.H., and Haikala, l.J. Virtual memory behavior of some sorting algorithms. IEEE Trans. on Software Engr. 10 (1984), 422-431.Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. 2 Dvorak, S., and Durian, B. Towards an efficient merging. Lecture Notes in Computer Science 233 (1986), 290-298. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. 3 Horvath, E.C. Stable sorting in asymptotically optima} time and extra space. J. of the ACM 25 (1978), 177-199. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. 4 Huang, B.C., and Langston, M.A. Fast stable merging and sorting in constant extra space, Computer Science Department Technical Report CS-87-170, Washington State University, 1987.Google ScholarGoogle Scholar
  5. 5 Huang, B.C., and Langston, M.A. Stable duplicate-key extraction with optimal time and space hounds. Acta lnformatica, to appear. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. 6 Huang, B.C., and Langston, M.A. Stable set and multiset operations in optimal time and space, Computer Science Department Technical Report CS-87-166, Washington State University, 1987.Google ScholarGoogle Scholar
  7. 7 Knuth, D.E. The Art of Computer Programming, Vol. 3: Sorting and Searching. Addison-Wesley, Reading, Mass., 1973. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. 8 Kronrod, M.A. An optimal ordering algorithm without a field of operation (in Russian}, Dok. Akad. Nauk SSSR 186 (1969), 1256-1258.Google ScholarGoogle Scholar
  9. 9 Mannila, H., and Ukkonen, E. A simple linear-time algorithm for in situ merging. Information Processing Letters 18 (1984}, 2:03-208. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. 10 Pardo, L.T. Stable sorting and merging with optimal space and time bounds. SIAM 1. Comput. 6 (1977), 351-372.Google ScholarGoogle Scholar

Index Terms

  1. Practical in-place merging

      Recommendations

      Reviews

      Snehamay Bandyapadhyay

      The authors have presented an interesting algorithm for in-place merging of two sorted lists. The paper is well written: section 2 presents an especially clear and easy-to-understand overview of the main algorithm. To merge a total of n records contained in two sorted lists, the authors use O(:.PC9 :3WzL n) blocks, each of size O(:.PC9 :3WzL n). The blocks are first arranged and then, using one block as an internal buffer, the records are merged by passing the internal buffer across the list. The paper also contains a section on implementation details that is sufficient to implement the algorithm. The authors agree that the algorithm is not stable and refer to a modified version of the algorithm, which is stable. They claim that the modified algorithm is faster than existing algorithms, but the claim is not substantiated in this paper. This paper will be of interest to any reader interested in merging of files; however, a casual reader may be advised to skip section 3. Finally, the algorithm is simple but not as simple as the authors claim it to be.

      Access critical reviews of Computing literature here

      Become a reviewer for Computing Reviews.

      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 Communications of the ACM
        Communications of the ACM  Volume 31, Issue 3
        March 1988
        111 pages
        ISSN:0001-0782
        EISSN:1557-7317
        DOI:10.1145/42392
        Issue’s Table of Contents

        Copyright © 1988 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 March 1988

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader