A framework for adaptive sorting

  • Ola Petersson
  • Alistair Moffat
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 621)

Abstract

A sorting algorithm is adaptive if it sorts sequences that are close to sorted faster than it sorts random sequences, where the distance is determined by some measure of presortedness. Over the years several measures of presortedness have been proposed in the literature, but it has been far from clear how they relate to each other. We show that there exists a natural partial order on the set of measures, which makes it possible to say that some measures are superior to others. We insert all known measures of presortedness into the partial order, and thereby provide a powerful tool for evaluating both measures and adaptive sorting algorithms. We further present a new measure and show that it is a maximal known element in the partial order, and thus that any sorting algorithm that optimally adapts to the new measure also optimally adapts to all other known measures of presortedness.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [1]
    W.H. Burge. Sorting, trees, and measures of order. Inform. and Control, 1:181–197, 1958.Google Scholar
  2. [2]
    S. Carlsson, C. Levcopoulos, and O. Petersson. Sublinear merging and Natural Mergesort. Algorithmica. To appear. Prel. version in Proc. Internat. Symp. on Algorithms, pages 251–260, LNCS 450, Springer-Verlag, 1990.Google Scholar
  3. [3]
    C.R. Cook and D.J. Kim. Best sorting algorithms for nearly sorted lists. Comm. ACM, 23:620–624, 1980.Google Scholar
  4. [4]
    G.R. Dromey. Exploiting partial order with Quicksort. Software—Practice and Experience, 14:509–518, 1984.Google Scholar
  5. [5]
    V. Estivill-Castro and D. Wood. A new measure of presortedness. Inform. and Comput., 83:111–119, 1989.Google Scholar
  6. [6]
    M.L. Fredman. How good is the information theory bound in sorting? Theoret. Comput. Sci., 1:355–361, 1976.Google Scholar
  7. [7]
    J. Katajainen, C. Levcopoulos, and O. Petersson. Local Insertion Sort revisited. In Proc. Internat. Symp. on Optimal Algorithms, pages 239–253. LNCS 401, Springer-Verlag, 1989.Google Scholar
  8. [8]
    D.E. Knuth. The Art of Computer Programming, Vol. 3: Sorting and Searching. Addison-Wesley, Reading, MA, 1973.Google Scholar
  9. [9]
    C. Levcopoulos and O. Petersson. Adaptive Heapsort. J. Algorithms. To appear. Prel. version in Proc. 1989 Workshop on Algorithms and Data Structures, pages 499–509, LNCS 382, Springer-Verlag, 1989.Google Scholar
  10. [10]
    C. Levcopoulos and O. Petersson. Sorting shuffled monotone sequences. Inform. and Comput. To appear. Prel. version in Proc. 2nd Scandinavian Workshop on Algorithm Theory, pages 181–191, LNCS 447, Springer-Verlag, 1990.Google Scholar
  11. [11]
    H. Mannila. Measures of presortedness and optimal sorting algorithms. IEEE Trans. Comput., C-34:318–325, 1985.Google Scholar
  12. [12]
    K. Mehlhorn. Data Structures and Algorithms, Vol. 1: Sorting and Searching. Springer-Verlag, Berlin, Germany, 1984.Google Scholar
  13. [13]
    A.M. Moffat and O. Petersson. Historical searching and sorting. In Proc. Internat. Symp. on Algorithms, pages 263–272. LNCS 557, Springer-Verlag, 1991.Google Scholar
  14. [14]
    O. Petersson. Adaptive Sorting. PhD thesis, Department of Computer Science, Lund Univ., Lund, Sweden, 1990.Google Scholar
  15. [15]
    S.S. Skiena. Encroaching lists as a measure of presortedness. BIT, 28:775–784, 1988.Google Scholar

Copyright information

© Springer-Verlag 1992

Authors and Affiliations

  • Ola Petersson
    • 1
  • Alistair Moffat
    • 2
  1. 1.Dept. Comp. Sci.Lund Univ.LundSweden
  2. 2.Dept. Comp. Sci.Univ. MelbourneParkvilleAustralia

Personalised recommendations