Abstract
We present an algorithm for asymptotically efficient k-way merging. Given an array A containing sorted subsequences A 1,...,A k of respective lengths n 1,...,n k , where \(\sum_{i=1}^{k}n_i = n\), our algorithm merges A 1,...,A k in-place, into a single sorted sequence, performing \(\lceil{\lg k}\rceil\!\cdot\!n + o(n)\) element comparisons and 3·n + o(n) element moves. That is, our algorithm runs in linear time, with the number of moves independent of k, the number of input sequences.
This work was supported by the Slovak Grant Agency for Science (VEGA) under contract 1/0035/09 .
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Chen, J.: Optimizing Stable In-Place Merging. Theoret. Comput. Sci. 302, 191–210 (2003)
Franceschini, G., Geffert, V.: An In-Place Sorting with \(O(n\!\cdot\!\lg n)\) Comparisons and O(n) Moves. J. Assoc. Comput. Mach. 52, 515–537 (2005)
Geffert, V., Katajainen, J., Pasanen, T.: Asymptotically Efficient In-Place Merging. Theoret. Comput. Sci. 237, 159–181 (2000)
Katajainen, J., Pasanen, T.: In-Place Sorting with Fewer Moves. Inform. Process. Lett. 70, 31–37 (1999)
Katajainen, J., Pasanen, T., Teuhola, J.: Practical In-Place Mergesort. Nordic J. Comput. 3, 27–40 (1996)
Knuth, D.E.: The Art of Computer Programming, 2nd edn. Sorting and Searching, vol. 3. Addison-Wesley, Reading (1998)
Mannila, H., Ukkonen, E.: A Simple Linear-Time Algorithm for In Situ Merging. Inform. Process. Lett. 18, 203–208 (1984)
Wegener, I.: Bottom-Up-Heapsort, a New Variant of Heapsort Beating, on an Average, Quicksort (If n Is Not Very Small). Theoret. Comput. Sci. 118, 81–98 (1993)
Williams, J.W.J.: Heapsort (Algorithm 232). Comm. Assoc. Comput. Mach. 7, 347–348 (1964)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2009 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Geffert, V., Gajdoš, J. (2009). Multiway In-Place Merging. In: Kutyłowski, M., Charatonik, W., Gębala, M. (eds) Fundamentals of Computation Theory. FCT 2009. Lecture Notes in Computer Science, vol 5699. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-03409-1_13
Download citation
DOI: https://doi.org/10.1007/978-3-642-03409-1_13
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-03408-4
Online ISBN: 978-3-642-03409-1
eBook Packages: Computer ScienceComputer Science (R0)