## On optimal and efficient in place merging (2006)

Venue: | SOFSEM 2006. Volume 3831 of Lecture Notes in Computer Science |

Citations: | 2 - 2 self |

### BibTeX

@INPROCEEDINGS{Kim06onoptimal,

author = {Pok-son Kim and Arne Kutzner},

title = {On optimal and efficient in place merging},

booktitle = {SOFSEM 2006. Volume 3831 of Lecture Notes in Computer Science},

year = {2006},

pages = {350--359},

publisher = {Springer}

}

### OpenURL

### Abstract

Abstract. We introduce a new stable in place merging algorithm that needs O(m log ( n +1)) comparisons and O(m+n) assignments. According m to the lower bounds for merging our algorithm is asymptotically optimal regarding the number of comparisons as well as assignments. The stable algorithm is developed in a modular style out of an unstable kernel for which we give a definition in pseudocode. The literature so far describes several similar algorithms but merely as sophisticated theoretical models without any reasoning about their practical value. We report specific benchmarks and show that our algorithm is for almost all input sequences faster than the efficient minimum storage algorithm by Dudzinski and Dydek. The proposed algorithm can be effectively used in practice. 1

### Citations

90 |
Introduction to Algorithms. 2nd edn
- Cormen, Leiserson, et al.
- 2001
(Show Context)
Citation Context ...s. An algorithm that meets this lower bound is presented in [7]. (4) Binary Search and Insertion-Sort are two standard algorithms described in almost all introducing literature about algorithms (e.g. =-=[14]-=-). 3 The Core Algorithm We now give the definition of our unstable core algorithm that relies on extra storage of size ⌊ √ m⌋ for local merges. Algorithm 1: Unstable-Core-Merge Let k = ⌊ √ m⌋ and l = ... |

45 | A simple algorithm for merging two disjoint linearly ordered sets
- Hwang, Lin
- 1972
(Show Context)
Citation Context ...put sequences u and v respectively. We will use six other algorithms as subcomponents. We now briefly introduce these algorithms and their complexity (A summary is given in Tab. 1): (1) Hwang and Lin =-=[13]-=- introduced a merging-algorithm that is optimal regarding the number of comparisons as well as assignments. Unfortunately their algorithm is not in-place, it relies on an external buffer of size m whe... |

19 |
Practical in-place merging
- Huang, Langston
- 1988
(Show Context)
Citation Context ...n contained in the C++ Standard Template Libraries (STL) [8]. Significant older works in the area of in place merging are the publications of Pardo [9], Salowe and Steiger [10] and Huang and Langston =-=[11]-=-. All algorithms introduced there are asymptotically optimal regarding the number of assignments, but lack in meeting the lower bound for comparisons. Another class of merging algorithms are the minim... |

16 |
Simplified stable merging tasks
- Salowe, Steiger
- 1987
(Show Context)
Citation Context ...merge_without_buffer function contained in the C++ Standard Template Libraries (STL) [8]. Significant older works in the area of in place merging are the publications of Pardo [9], Salowe and Steiger =-=[10]-=- and Huang and Langston [11]. All algorithms introduced there are asymptotically optimal regarding the number of assignments, but lack in meeting the lower bound for comparisons. Another class of merg... |

13 | Optimal stable merging
- Symvonis
- 1995
(Show Context)
Citation Context ...shown by Knuth in [1] the lower bound for the number of comparisons is Ω(m log( n m + 1)), where m ≤ n. So far there are three publications about optimal stable in place merging. The work of Symvonis =-=[2]-=- shows how to get an optimal algorithm by combining several given concepts but contains no information about the involved asymptotic constants or implementation aspects. Geffert et. all present in [3]... |

9 |
A simple linear-time algorithm for in situ merging
- Mannila, Ukkonen
- 1984
(Show Context)
Citation Context ...t a concrete implementation. All three publications ⋆ This work was supported by the Kookmin University research grant in 2005.shave some resemblance. They take the algorithm from Mannila and Ukkonen =-=[5]-=- as starting point, rely on the concept of an internal buffer introduced by Kronrod in [6] and develop a stable algorithm out of an unstable one. We will follow this path but with the focus on an impr... |

9 |
template library: http://www.sgi.com/tech/stl/allocators.html
- Standard
(Show Context)
Citation Context ...wn by the fact that it can compete with the algorithm of Dudzinski and Dydek [7] that is used as foundation of the merge_without_buffer function contained in the C++ Standard Template Libraries (STL) =-=[8]-=-. Significant older works in the area of in place merging are the publications of Pardo [9], Salowe and Steiger [10] and Huang and Langston [11]. All algorithms introduced there are asymptotically opt... |

9 |
Stable sorting and merging with optimal space and time bounds
- Pardo
- 1977
(Show Context)
Citation Context ...ed as foundation of the merge_without_buffer function contained in the C++ Standard Template Libraries (STL) [8]. Significant older works in the area of in place merging are the publications of Pardo =-=[9]-=-, Salowe and Steiger [10] and Huang and Langston [11]. All algorithms introduced there are asymptotically optimal regarding the number of assignments, but lack in meeting the lower bound for compariso... |

8 |
An optimal ordering algorithm without a field of operation,” Dokl
- Kronrod
- 1969
(Show Context)
Citation Context ...in University research grant in 2005.shave some resemblance. They take the algorithm from Mannila and Ukkonen [5] as starting point, rely on the concept of an internal buffer introduced by Kronrod in =-=[6]-=- and develop a stable algorithm out of an unstable one. We will follow this path but with the focus on an improved stable algorithm as well as concrete benchmarking. The proposed stable algorithm can ... |

6 |
The Art of Computer Programming, volume Vol. 3: Sorting and Searching
- Knuth
- 1973
(Show Context)
Citation Context ...ficant lower bounds for merging. The lower bound for the number of assignments is m + n because every element of the input sequences can change its position in the sorted output. As shown by Knuth in =-=[1]-=- the lower bound for the number of comparisons is Ω(m log( n m + 1)), where m ≤ n. So far there are three publications about optimal stable in place merging. The work of Symvonis [2] shows how to get ... |

6 |
T.: Asymptotically efficient in-place merging. Theoretical Computer Science 237
- Geffert, Katajainen, et al.
- 2000
(Show Context)
Citation Context ...[2] shows how to get an optimal algorithm by combining several given concepts but contains no information about the involved asymptotic constants or implementation aspects. Geffert et. all present in =-=[3]-=- a rather complex algorithm together with its asymptotic constants, but there are no notes regarding any successful implementation or benchmarking. Chen [4] simplified Geffert’s algorithm for the pric... |

5 |
On a Stable Storage Merging Algorithm
- Dudzinski, Dydek
- 1981
(Show Context)
Citation Context ...stable algorithm as well as concrete benchmarking. The proposed stable algorithm can be effectively used in practice as shown by the fact that it can compete with the algorithm of Dudzinski and Dydek =-=[7]-=- that is used as foundation of the merge_without_buffer function contained in the C++ Standard Template Libraries (STL) [8]. Significant older works in the area of in place merging are the publication... |

4 |
Optimizing stable in-place merging. Theoretical Computer Science 302
- Chen
- 2003
(Show Context)
Citation Context ...ntation aspects. Geffert et. all present in [3] a rather complex algorithm together with its asymptotic constants, but there are no notes regarding any successful implementation or benchmarking. Chen =-=[4]-=- simplified Geffert’s algorithm for the price of slightly worse asymptotic constants but also without any remarks about a concrete implementation. All three publications ⋆ This work was supported by t... |

4 |
Programming Pearls, 2nd edn
- Bentley
- 2000
(Show Context)
Citation Context ...r its efficiency. A serious question that still remains is the role of the subalgorithms as driving factor of the overall running time. E.g. there are several rotation algorithms and Bentley shows in =-=[15]-=- that the best one from the theoretical point of view is not always the best one in practice. Another question is whether there exists a structurally more homogeneous and less complex algorithm with t... |

2 | A.: Stable minimum storage merging by symmetric comparisons
- Kim, Kutzner
- 2004
(Show Context)
Citation Context ...totically optimal regarding the number of assignments, but lack in meeting the lower bound for comparisons. Another class of merging algorithms are the minimum storage algorithms presented in [7] and =-=[12]-=- which both rely on O(log 2 (m+n)) bits of extra storage. The latter two algorithms are effective in practice and simply structured, but they are not asymptotically optimal regarding the number of ass... |