Fast Stable In - Place Sorting with O ( n ) Data Moves 1
نویسنده
چکیده
Until recently, it was not known whether it was possible to sort stably (i.e., keeping equal elements in their initial order) an array of n elements using only O(n) data moves and O(1) extra space. In [13] an algorithm was given to perform this task in O(n2) comparisons in the worst case. Here, we develop a new algorithm for the problem that performs only O(n1+ε) comparisons (0 < ε ≤ 1 is any fixed constant) in the worst case. This bound on the number of comparisons matches (asymptotically) the best known bound for the same problem with the stability constraint dropped.
منابع مشابه
An In-Place Sorting Algorithm Performing O(n log n) Comparisons and O(n) Data Moves
In this paper we give a positive answer to the long-standing problem of finding an in-place sorting algorithm performing O(n log n) comparisons and O(n) data moves in the worst case. So far, the better in-place sorting algorithm with O(n) moves was proposed by Munro and V. Raman. Their algorithm requires O(n) comparisons in the worst case, for any ǫ > 0. Later, Katajainen and Pasanen discovered...
متن کاملIn-Place Sorting with Fewer Moves
It is shown that an array of n elements can be sorted using O(1) extra space, O(n log n= log log n) element moves, and n log 2 n+O(n log log n) comparisons. This is the rst in-place sorting algorithm requiring o(n log n) moves in the worst case while guaranteeing O(n log n) comparisons, but due to the constant factors involved the algorithm is predominantly of theoretical interest.
متن کاملARL, a faster in-place, cache friendly sorting algorithm
This paper introduces a new, faster sorting algorithm (ARL – Adaptive Left Radix) that does in-place, non-stable sorting. Left Radix, often called MSD (Most Significant Digit) radix, is not new in itself, but the adaptive feature and the in-place sorting ability are new features. ARL does sorting with only internal moves in the array, and uses a dynamically defined radix for each pass. ALR is a...
متن کاملRadix Sorting with No Extra Space
It is well known that n integers in the range [1, n] can be sorted in O(n) time in the RAM model using radix sorting. More generally, integers in any range [1, U ] can be sorted in O(n √ log log n) time [5]. However, these algorithms use O(n) words of extra memory. Is this necessary? We present a simple, stable, integer sorting algorithm for words of size O(log n), which works in O(n) time and ...
متن کاملAsymptotically Eecient In-place Merging ?
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 rst 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.
متن کامل