An implicit data structure supporting insertion, deletion, and search in O(log:OS2:OEn) time
Journal of Computer and System Sciences
Simplified stable merging tasks
Journal of Algorithms
Communications of the ACM
A balanced search tree with O(1) worst case update time
Acta Informatica
A survey of adaptive sorting algorithms
ACM Computing Surveys (CSUR)
Stable set and multiset operations in optimal time and space
Proceedings of the seventh ACM SIGACT-SIGMOD-SIGART symposium on Principles of database systems
Stable Sorting in Asymptotically Optimal Time and Extra Space
Journal of the ACM (JACM)
In-place sorting with fewer moves
Information Processing Letters
Asymptotically efficient in-place merging
Theoretical Computer Science
Introduction to Algorithms
A Simple Balanced Search Tree with O(1) Worst-Case Update Time
ISAAC '93 Proceedings of the 4th International Symposium on Algorithms and Computation
Comparison-Efficient And Write-Optimal Searching and Sorting
ISA '91 Proceedings of the 2nd International Symposium on Algorithms
Optimizing stable in-place merging
Theoretical Computer Science
An in-place sorting with O(nlog n) comparisons and O(n) moves
Journal of the ACM (JACM)
Theoretical Computer Science
Hi-index | 0.01 |
In the comparison model the only operations allowed on input elements are comparisons and moves to empty cells of memory. We prove the existence of an algorithm that, for any set of s ≤n sorted sequences containing a total of n elements, computes the whole sorted sequence using O(nlogs) comparisons, O(n) data moves and O(1) auxiliary cells of memory besides the ones necessary for the n input elements. The best known algorithms with these same bounds are limited to the particular case s= O(1). From a more intuitive point of view, our result shows that it is possible to pass from merging to sorting in a seamless fashion, without losing the optimality with respect to any of the three main complexity measures of the comparison model. Our main statement has an implication in the field of adaptive sorting algorithms and improves [Franceschini and Geffert, Journal of the ACM, 52], showing that it is possible to exploit some form of pre-sortedness to lower the number of comparisons while still maintaining the optimality for space and data moves. More precisely, let us denote with OptM(X) the cost for sorting a sequence X with an algorithm that is optimal with respect to a pre-sortedness measure M. To the best of our knowledge, so far, for any pre-sortedness measure M, no full-optimal adaptive sorting algorithms were known (see [Estivill-Castro and Wood, ACM Comp. Surveys, 24], page 472). The best that could be obtained were algorithms sorting a sequence X using O(1) space, O(OptM(X)) comparisons and O(OptM(X)) moves. Hence, the move complexity seemed bound to be a function of M(X) (as for the comparison complexity). We prove that there exists a pre-sortedness measure for which that is false: the pre-sortedness measure Runs, defined as the number of ascending contiguous subsequences in a sequence. That follows directly from our main statement, since ${Opt}_{M}(X)=O(\left\vert{X}\right\vert \log Runs(X))$