Sublinear merging and natural mergesort
- 191 Downloads
The complexity of merging two sorted sequences into one is linear in the worst case as well as in the average case. There are, however, instances for which a sublinear number of comparisons is sufficient. We consider the problem of measuring and exploiting such instance easiness. The merging algorithm presented, Adaptmerge, is shown to adapt optimally to different kinds of measures of instance easiness. In the sorting problem the concept of instance easiness has received a lot of attention, and it is interpreted by a measure of presortedness. We apply Adaptmerge in the already adaptive sorting algorithm Natural Mergesort. The resulting algorithm, Adaptive Mergesort, optimally adapts to several, known and new, measures of presortedness. We also prove some interesting results concerning the relation between measures of presortedness proposed in the literature.
Key wordsMerging Sorting Instance easiness Measures
Unable to display preview. Download preview PDF.
- K. Mehlhorn.Data Structures and Algorithms, Vol. 1. Springer-Verlag, Berlin, 1984.Google Scholar
- W. H. Burge. Sorting, trees, and measures of order.Information and Control, 1(3):181–197, 1958.Google Scholar
- C. R. Cook and D. J. Kim. Best sorting algorithms for nearly sorted lists.Communications of the ACM, 23 (11):620–624, 1980.Google Scholar
- D. E. Knuth.The Art of Computer Programming, Vol. 3. Addison-Wesley, Reading, Mass., 1973.Google Scholar
- H. Mannila. Measures of presortedness and optimal sorting algorithms.IEEE Transactions on Computers, 34(4):318–325, 1985.Google Scholar
- O. Petersson and A. Moffat. A framework for adaptive sorting. InProceedings of the Third Scandinavian Workshop on Algorithm Theory, pp. 422–433. Lecture Notes in Computer Science, Vol. 621, Springer-Verlag, Berlin, 1992.Google Scholar
- M. L. Fredman. How good is the information theory bound in sorting?Theoretical Computer Science, 1:355–361, 1976.Google Scholar
- O. Petersson. Adaptive Sorting. Ph.D. thesis, Department of Computer Science, Lund University, Lund, 1990.Google Scholar
- H. Mannila and E. Ukkonen. A simple linear-time algorithm for in situ merging.Information Processing Letters, 18(4):203–208, 1984.Google Scholar
- A. Moffat. Adaptive merging and a naturally Natural Merge Sort. InProceedings of the 14th Australian Computer Science Conference, pp. 08.1–08.8, 1991.Google Scholar