Skip to main content
Log in

Computing inversion pair cardinality through partition-based sorting

  • Published:
Computing Aims and scope Submit manuscript

Abstract

In this paper, we introduce a new randomized, partition-based algorithm for the problem of computing the number of inversion pairs in an unsorted array of n numbers. The algorithm runs in expected time O(n · log n) and uses O(n) extra space. The expected time analysis of the new algorithm is different from the analyses existing in the literature, in that it explicitly uses inversion pairs. The problem of determining the inversion pair cardinality of an array finds applications in a number of design domains, including but not limited to real-time scheduling and operations research. At the heart of our algorithm is a new inversion pair conserving partition procedure that is different from existing partition procedures such as Hoare-partition and Lomuto-partition. Although the algorithm is not fully adaptive, we believe that it is the first step towards the design of an adaptive, partition-based sorting algorithm whose running time is proportional to the number of inversion pairs in the input.

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. Bistarelli S, Gennari R, Rossi F (2000) Constraint propagation for soft constraints: generalization and termination conditions. In: CP, pp 83–97

  2. Bentley JL, McIlroy MD (1993) Engineering a sort function. Softw Practice Exp 23(11): 1249–1265

    Article  Google Scholar 

  3. Brown MR, Tarjan RE (1980) Design and analysis of data structures for representing sorted lists. SIAM J Comput 9: 594–614

    Article  MATH  MathSciNet  Google Scholar 

  4. Burge WH (1958) Sorting, trees and measures of order. Inf Control 1(3): 181–197

    Article  MATH  MathSciNet  Google Scholar 

  5. Cook CR, Kim DJ (1980) Best sorting algorithms for nearly linearly sorted lists. Commun ACM 23: 620–624

    Article  Google Scholar 

  6. Cormen TH, Leiserson CE, Rivest RL (1992) Introduction to algorithms, 2nd edn. MIT Press and McGraw-Hill Book Company, Boston

    Google Scholar 

  7. Cormen TH, Leiserson CE, Rivest RL, Stein C (2001) Introduction to algorithms. MIT Press, New York

    MATH  Google Scholar 

  8. Demtrescu C (2004) A new approach to dynamic all pairs shortest paths. J ACM 51(6): 968–992

    Article  MathSciNet  Google Scholar 

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

    Article  Google Scholar 

  10. Guibas LJ, McCreight EM, Plass MF (1977) A new represenation of linear lists. In: Symposium on the theory of computing, pp 49–60

  11. Gonzalez O, Shrikumar H, Ramamritham K, Stankovic J (1997) Adaptive fault tolerance and graceful degradation under dynamic hard real-time scheduling. In: Real-time systems symposium, San Francisco

  12. Herrmann C (1994) Vbr video in atm without frame buffering: influence of a periodic correlation function on qos parameters. In: Modelling and evaluation of ATM networks, pp 14–31

  13. Hoare CAR (1961) Quicksort. Commun ACM 4(7): 321

    Article  Google Scholar 

  14. Kiwiel KC (2003) Partitioning schemes for quicksort and quickselect, Warsaw

  15. Kalyanasundaram, Pruhs (2000) Fault-tolerant real-time scheduling. ALGRTHMICA: Algorithmica, 28

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

    Article  MATH  MathSciNet  Google Scholar 

  17. McIlroy MD (1999) A killer adversary for quicksort. Softw Practice Exp 29(4): 341–344

    Article  Google Scholar 

  18. Mehlhorn K (1984) Data structures and algorithms, vol I: Sorting and Searching. EATCS monographs on Theoretical Computer Science. Springer, Heidelberg

  19. Martínez C, Roura S (2001) Optimal sampling strategies in quicksort and quickselect. SIAM J Comput 31(3): 683–705

    Article  MathSciNet  MATH  Google Scholar 

  20. Petersson O (1990) Adaptive sorting. PhD Thesis, Lund University, Lund, Sweden

  21. Pradhan DK (1986) Fault-tolerant computing: theory and techniques. Prentice Hall, Englewood Cliffs, NJ

    Google Scholar 

  22. Stankovic J (1988) Misconceptions about real-time computing. IEEE Comput 21(10):10–19

    Google Scholar 

  23. Stankovic JA (1988) Real-time computing systems: the next generation. In: Stankovic JA, Ramamritham K (eds) Tutorial: hard real time systems. IEEE 14:38

  24. Takoka T (2008) Minimal mergesort (manuscript)

  25. van Emden MH (1970) Algorithms 402: Increasing the efficiency of quicksort. Commun ACM 13(11): 693–694

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to K. Subramani.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Subramani, K. Computing inversion pair cardinality through partition-based sorting. Computing 83, 41–54 (2008). https://doi.org/10.1007/s00607-008-0011-x

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00607-008-0011-x

Keywords

Mathematics Subject Classification (2000)

Navigation