Efficient algorithms for merging (original) (raw)
Related papers
Optimal expected-time algorithms for merging
Journal of Algorithms, 1986
Optimal expected-time algorithms for (2, n) and (3, n) merge problems are given. Let f,(k) denote the largest n such that two ordered lists of lengths m and n can be merged in k comparisons. Our methods explore the merge trees of (2, fi (k)) and (3, f3(k)) problems and narrow down the choices of pairwise comparisons to minimize the expected number of comparisons even when n is not equal to h(k) or f,(k). The given methods are constructive and the computed values reveal that the optimal expected value differs from the optimal worst-case value by at most 1. 0 19R6 Academic f'ress. Inc.
On a Simple and Stable Merging Algorithm
Journal of Korean Institute of Intelligent Systems, 2010
We investigate the worst case complexity regarding the number of comparisons for a simple and stable merging algorithm. The complexity analysis shows that the algorithm performs log comparisons for two sequences of sizes and ≤ . So, according to the lower bound for merging log , the algorithm is asymptotically optimal regarding the number of comparisons. For proving the worst case complexity we divide the domain of all inputs into two disjoint cases. For either of these cases we will extract a special subcase and prove the asymptotic optimality for these two subcases. Using this knowledge for special cases we will prove the optimality for all remaining cases. By using this approach we give a transparent solution for the hardly tractable problem of delivering a clean complexity analysis for the algorithm.
Merge sort is one of the most efficient ways to solve sorting problem. Our research suggests that it is still responsive to clever optimizations. A considerably fast variation of Merge sort has been proposed in this paper. Proposed algorithm uses some novel optimizations to improve the speed of the proposed algorithm. Proposed algorithm not only applies some novel optimizations but also retains most of the old optimizations which were effective in reducing space and time. In addition to time and space efficiency, proposed algorithm offers the benefit of elegant design. Profiling has been carried out to verify the effectiveness of proposed algorithm. Profiling results reinforce the fact that proposed algorithm is significantly faster than existing best algorithm.
International Journal For Technological Research In Engineering, 2013
Given a sequence of N elements a1, a2, a3, …, aN. The desired output will be a'1, a'2, a'3,…, a'N such that a'1≤, a'2≤, a'3≤…≤a'N using merge sort. In this paper, we propose a modification to the existing merge sort algorithm to sort the given elements when the input sequence (or a part of it) is in ascending or descending order in a more efficient way by reducing the number of comparisons between two sub arrays.
An Alternative Approach to the Efficiency of Recursive Merge Sort
2020
The time complexity (also called asymptotic running time or operational complexity) Θ(n lgn) of merge sort is usually calculated by solving the recurrence T (n) = {︂ T (⌊n/2⌋) + T (⌈n/2⌉) + Θ(n) if n > 1, Θ(1) if n = 1, where n is the length of the sequence of keys to be sorted, T (n) is either the best-case or the worst-case asymptotic running time of the algorithm, Θ(n) is that of division + sorted merge, and Θ(1) is that of the base case [1, 2]. In this paper we invent an alternative approach: We analyze the structure of the tree of recursive calls, consider its depth and estimate the number of steps [8] of computation at the different levels of that tree. Compared to the equation above we use a more strict notation [5, 6, 7] and argue about its scientific and didactic advantages in efficiency analysis of algorithms in general.
An optimal parallel algorithm for merging using multiselection
Information Processing Letters, 1994
O(log(minfj; mg)) z time without explicitly merging A and B [5, 6]. Multiselection, a generalization of selection, is the problem where given a sequence of r integers 1 K 1 < K 2 < : : : < K r (m + n), all the K i th, 1 i r, smallest elements in A and B combined are to be found. y Supported in part by NSF Grant CDA-9115281. z For clarity in presentation, we use log x to mean maxf1; log 2 xg.
The k-way merging problem is to find a new sorted array as an output from k sorted arrays as an input. In this paper, we consider the elements of the k sorted arrays are data record, where the value of the key for each record is a serial number. The problem is used to design efficient external sorting algorithm. We proposed two optimal parallel algorithms for k merging. The first one is based on merging k sorted arrays of n records in a new sorted array of length n. The second one is based on merging k sorted arrays of n records in a new sorted array of length n+o(n) which is called padded merging. The running time for each algorithm is O(log n) and O(1) under EREW and CRCW PRAM respectively.
Comparison of Merge Sort with a New Tri- Merge Sorting Algorithm
2010
The sorting problem is one of the most fundamental problems in computer science. This paper is concerned with a new Tri-merge sorting algorithm. This is a modification of Merge sort. It is competitive with the fastest shorting algorithms, especially when the number of elements to be sorted is too large. Compared with the preceding Merge sort, Tri-merge sort is more robust. It is not only faster on random inputs, but also avoids extreme comparisons. The empirical results show that Tri-merge sort is faster than Merge sort. This reduces the time complexity and makes the algorithm faster. For a large data, we try to implement this algorithm in well known programming language Java.
Time-space optimal parallel merging and sorting
IEEE Transactions on Computers, 1991
A parallel algorithm is time-space optimal if it achieves optimal speedup and if it uses only a constant amount of extra space per processor even when the number of processors is fixed. Previously published parallel merging and sorting algorithms fail to meet at least one of these criteria. In this paper, we present a parallel merging algorithm that, on an EREW PRAM with k processors, merges two sorted lists of total length n in O (n / k + log n) time and O(k) extra space, and is thus time-space optimal for any value of k 5 n / (log n). We also describe a stable version of our parallel merging algorithm that is similarly time-space optimal on an EREW PRAM. These two parallel merges naturally lead to time-space optimal parallel sorting algorithms.
Bottom-up mergesort ? A detailed analysis
Algorithmica, 1995
Though the behaviors of mergesort algorithms are basically known, the periodicity phenomena encountered in their analyses are not easy to deal with. In this paper closed-form expressions for the necessary number of comparisons are derived for the bottom-up algorithm, which adequately describe its periodic behavior. This allows, among other things, to compare the top-down and the bottom-up mergesort algorithms.