## Asymptotically Efficient in-Place Merging (0)

Venue: | Theoretical Computer Science |

Citations: | 14 - 3 self |

### BibTeX

@ARTICLE{Geffert_asymptoticallyefficient,

author = {Viliam Geffert and Jyrki Katajainen and Tomi Pasanen},

title = {Asymptotically Efficient in-Place Merging},

journal = {Theoretical Computer Science},

year = {},

volume = {237},

pages = {2000}

}

### OpenURL

### Abstract

Two linear-time algorithms for in-place merging are presented. Both algorithms perform at most m(t+1)+n=2 t +o(m) comparisons, where m and n are the sizes of the input sequences, m n, and t = blog 2 (n=m)c. The first algorithm is for unstable merging and it carries out no more than 3(n+m)+o(m) element moves. The second algorithm is for stable merging and it accomplishes at most 5n+12m+o(m) moves. Key words: In-place algorithms, merging, sorting ? A preliminary and weaker version of this work appeared in Proceedings of the 20th Symposium on Mathematical Foundations of Computer Science, Lecture Notes in Computer Science 969, Springer-Verlag, Berlin/Heidelberg (1995), 211--220. 1 Supported by the Slovak Grant Agency for Science under contract 1/4376/97 (Project "Combinational Structures and Complexity of Algorithms"). 2 Partially supported by the Danish Natural Science Research Council under contracts 9400952 (Project "Computational Algorithmics") and 9701414 (Project "Experimental Algorithmics"). Preprint submitted to Elsevier Preprint December 19, 1995 1

### Citations

2202 | The Art of Computer Programming - Knuth - 1973 |

45 | A simple algorithm for merging two disjoint linearly ordered list
- Hwang, Lin
- 1972
(Show Context)
Citation Context ...ll U-elements followed by all V -elements. If W = UV for blocks U , V , and W , then we write V = U \Gamma1 W and U = WV \Gamma1 . 2.1 Comparisons in merging The binary-merge routine of Hwang and Lin =-=[5]-=- was designed to save some comparisons in merging. We shall now describe how the comparisons are organized. Assume that two sorted sequences X and Y to be merged are of size m and n, respectively, wit... |

18 |
Practical in-place merging
- Huang, Langston
- 1988
(Show Context)
Citation Context ... if it retains the original order of X-elements; that of Y -elements; and, in the case of equal elements, outputs X-elements before Y -elements. Many algorithms for in-place merging has been proposed =-=[2,3,8,9,16]-=-. All these algorithms can be made stable [4,12,13,15], but the resulting algorithms are complicated. The first publication showing that merging is possible in a linear time without a workspace, i.e. ... |

16 | Simplified stable merging tasks - Salowe, Steiger - 1987 |

13 |
Selection from read-only memory and sorting with minimum data movement. Theoret
- Munro, Raman
- 1996
(Show Context)
Citation Context ...thm. There seems to be a trade-off between the number of moves and comparisons required, since the above lower bound is reachable with an algorithm performing a superlinear number of comparisons (cf. =-=[11]-=-). Note also that the block merging of Section 4.5 is an unstable merging algorithm performing 2n+3m+O(m 1=2 ) moves, when implemented with block size 1 and superblock size dm 1=2 e. The price we pay ... |

13 | Optimal stable merging
- Symvonis
- 1995
(Show Context)
Citation Context ...of Y -elements; and, in the case of equal elements, outputs X-elements before Y -elements. Many algorithms for in-place merging has been proposed [2,3,8,9,16]. All these algorithms can be made stable =-=[4,12,13,15]-=-, but the resulting algorithms are complicated. The first publication showing that merging is possible in a linear time without a workspace, i.e. in-place, was due to Kronrod [8]. About ten years late... |

10 |
Optimal ordering algorithm without operational eld
- Kronrod
- 1969
(Show Context)
Citation Context ...st n +m \Gamma 1 element comparisons and n+m element moves, but a separate output array of size n+m is needed. It is easy to reduce the size of the extra workspace to m (see [7, Exercise 5.2.410 ] or =-=[8]-=-): we can simply move the shorter sequence into the workspace and then merge back to the original array. Now, however, the number of element moves is n + 2m in the worst case. If the input sequences a... |

8 | Fast stable merging and sorting in constant extra space
- Huang, Langston
- 1992
(Show Context)
Citation Context ...of Y -elements; and, in the case of equal elements, outputs X-elements before Y -elements. Many algorithms for in-place merging has been proposed [2,3,8,9,16]. All these algorithms can be made stable =-=[4,12,13,15]-=-, but the resulting algorithms are complicated. The first publication showing that merging is possible in a linear time without a workspace, i.e. in-place, was due to Kronrod [8]. About ten years late... |

8 |
Practical in-place mergesort, Nordic
- Katajainen, Pasanen, et al.
- 1996
(Show Context)
Citation Context ...ment comparisons and 2(n + m) + o(n) element exchanges. Note, however, that each element exchange requires three moves. Therefore, the number of moves is bounded by 6(n + m) + o(n). Katajainen et al. =-=[6]-=- observed that the number of moves can be reduced to 5(n +m)+ o(n). For the stable algorithm given in [4], the number 45 of comparisons is the same as that required by the unstable algorithm, but the ... |

7 |
A simple linear-time algorithm for
- Mannila, Ukkonen
- 1984
(Show Context)
Citation Context ... if it retains the original order of X-elements; that of Y -elements; and, in the case of equal elements, outputs X-elements before Y -elements. Many algorithms for in-place merging has been proposed =-=[2,3,8,9,16]-=-. All these algorithms can be made stable [4,12,13,15], but the resulting algorithms are complicated. The first publication showing that merging is possible in a linear time without a workspace, i.e. ... |

7 |
Sorting with minimum data movement
- Munro, Raman
- 1992
(Show Context)
Citation Context ... Y 0 2 , i.e., in H and R. While the blocks of R get mixed up quite arbitrarily, the blocks of H are organized in a data structure similar to a d-heap, where d = d` 1=2 e, used and analysed, e.g., in =-=[10]-=-. That is, the blocks in H are divided into at most ` 1=2 superblocks, each consisting of d` 1=2 e blocks. The largest block in each superblock is stored in its rightmost position, called the top of a... |

6 |
On the optimality of linear merge
- Stockmeyer, Yao
- 1980
(Show Context)
Citation Context ...wever, the number of element moves is n + 2m in the worst case. If the input sequences are approximately of the same size, n + m \Gamma 1 is also the best possible bound for the number of comparisons =-=[14]-=-. However, if one of the sequences is considerably shorter, the merging problem can be solved with at most m log 2 (n=m)+2m comparisons. More precisely, m(t+1) + bn=2 t c comparisons are sufficient [5... |

4 |
Towards an efficient merging
- Dvorak, Durian
- 1986
(Show Context)
Citation Context ... if it retains the original order of X-elements; that of Y -elements; and, in the case of equal elements, outputs X-elements before Y -elements. Many algorithms for in-place merging has been proposed =-=[2,3,8,9,16]-=-. All these algorithms can be made stable [4,12,13,15], but the resulting algorithms are complicated. The first publication showing that merging is possible in a linear time without a workspace, i.e. ... |

3 |
On stable minimum storage merging algorithm
- Dudzi'nski, Dydek
- 1981
(Show Context)
Citation Context ... this task by exchanging the ith element of U and V for each i 2 f1; : : : ; jUjg. Since each exchange requires three element moves, the total number of moves performed is 3jU j. Dudzi'nski and Dydek =-=[1]-=- proved that this procedure is optimal. 47 The number of moves can be reduced to 2jU j if we can use the floating hole technique to be described next. Assume that there is an empty location e in front... |

3 |
Lajittelu minimitilassa, M.Sc
- Pasanen
- 1993
(Show Context)
Citation Context ...of Y -elements; and, in the case of equal elements, outputs X-elements before Y -elements. Many algorithms for in-place merging has been proposed [2,3,8,9,16]. All these algorithms can be made stable =-=[4,12,13,15]-=-, but the resulting algorithms are complicated. The first publication showing that merging is possible in a linear time without a workspace, i.e. in-place, was due to Kronrod [8]. About ten years late... |

3 |
Stable sorting and merging with optimal space and time bounds
- L
- 1977
(Show Context)
Citation Context |