Skip to main content
Log in

Adaptive sorting: an information theoretic perspective

  • Original Article
  • Published:
Acta Informatica Aims and scope Submit manuscript

Abstract

We present two algorithms that are near optimal with respect to the number of inversions present in the input. One of the algorithms is a variation of insertion sort, and the other is a variation of merge sort. The number of comparisons performed by our algorithms, on an input sequence of length n that has I inversions, is at most \(n\,{\rm log}_{2} (\frac{I}{n} + 1) + O(n)\) . Moreover, both algorithms have implementations that run in time \(O(n\,{\rm log}_{2} (\frac{I}{n} + 1)\,+\,n)\) . All previously published algorithms require at least \(cn\,{\rm log}_{2} (\frac{I}{n} + 1)\) comparisons for some c > 1.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Andersson, A., Lai, T.W.: Fast updating of well-balanced trees. In: Proceedings of Scandinavian Workshop on Algorithm Theory, pp. 111–121. Springer, Heidelberg (1990)

  2. Brown M. and Tarjan R. (1980). Design and analysis of data structures for representing sorted lists. SIAM J. Comput. 9: 594–614

    Article  MATH  MathSciNet  Google Scholar 

  3. Bentley J. and Yao A. (1976). An almost optimal algorithm for unbounded searching. Inf. Process. Lett. 5(3): 82–87

    Article  MATH  MathSciNet  Google Scholar 

  4. Carlsson S., Levcopoulos C. and Petersson O. (1993). Sublinear merging and natural Mergesort. Algorithmica 9: 629–648

    Article  MATH  MathSciNet  Google Scholar 

  5. Cole R. (2000). On the dynamic finger conjecture for splay trees. Part II: The proof. SIAM J. Comput. 30: 44–85

    Article  MATH  MathSciNet  Google Scholar 

  6. Elmasry, A.: Priority Queues, Pairing and Adaptive Sorting. 29th ICALP. LNCS, vol. 2380, pp. 183–194 (2002)

  7. Estivill-Castro V. (1992). A survey of adaptive sorting algorithms. ACM Comput. Surv. 24(4): 441–476

    Article  Google Scholar 

  8. Estivill-Castro V. and Wood D. (1989). A new measure of presortedness. Inf. Comput. 83: 111–119

    Article  MATH  MathSciNet  Google Scholar 

  9. Fredman M. (1976). How good is the information theory bound in sorting?. Theor. Comput. Sci. 1: 355–361

    Article  MATH  MathSciNet  Google Scholar 

  10. Guibas L., McCreight E., Plass M. and Roberts J. (1977). A new representation of linear lists. ACM Symp. Theory Comput. 9: 49–60

    MathSciNet  Google Scholar 

  11. Knuth, D.: The Art of Computer Programming: Sorting and Searching, vol. III, 2nd edn. Addison-wesley (1998)

  12. Levcopoulos C. and Petersson O. (1991). Splitsort—an adaptive sorting algorithm. Inf. Process. Lett. 39: 205–211

    Article  MATH  MathSciNet  Google Scholar 

  13. Levcopoulos C. and Petersson O. (1993). Adaptive heapsort. J. Algorithms 14: 395–413

    Article  MATH  MathSciNet  Google Scholar 

  14. Levcopoulos C. and Petersson O. (1994). Sorting shuffled monotone sequences. Inf. Comput. 112: 37–50

    Article  MATH  MathSciNet  Google Scholar 

  15. Levcopoulos C. and Petersson O. (1996). Exploiting few inversions when sorting: Sequential and parallel algorithms. Theor. Comput. Sci. 163: 211–238

    Article  MATH  MathSciNet  Google Scholar 

  16. Mannila H. (1985). Measures of presortedness and optimal sorting algorithms. IEEE Trans. Comput. C-34: 318–325

    Article  MathSciNet  Google Scholar 

  17. Mehlhorn K. (1984). Data Structures and Algorithms. Sorting and Searching, vol. 1. Springer, Berlin

    Google Scholar 

  18. Mehlhorn, K.: Sorting presorted files. In: Proceedings Of the 4th GI Conference on Theory of Computer Science. LNCS, vol. 67, pp. 199–212 (1979)

  19. Moffat, A., Petersson, O., Wormald, N.: A Tree-based Mergesort. Acta Informatica, pp. 775–793. Springer, Heidelberg (1998)

  20. Petersson O. and Moffat A. (1995). A framework for adaptive sorting. Discrete Appl. Math. 59: 153–179

    Article  MATH  MathSciNet  Google Scholar 

  21. Sleator D. and Tarjan R. (1985). Self-adjusting binary search trees. J. ACM 32(3): 652–686

    Article  MATH  MathSciNet  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Michael L. Fredman.

Additional information

M. L. Fredman was supported in part by NSF grant CCR-9732689.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Elmasry, A., Fredman, M.L. Adaptive sorting: an information theoretic perspective. Acta Informatica 45, 33–42 (2008). https://doi.org/10.1007/s00236-007-0061-0

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00236-007-0061-0

Keywords

Navigation