Skip to main content
Log in

Probabilistic analysis of a grouping algorithm

  • Published:
Algorithmica Aims and scope Submit manuscript

Abstract

We study thegrouping by swapping problem, which occurs in memory compaction and in computing the exponential of a matrix. In this problem we are given a sequence ofn numbers drawn from {0,1, 2,...,m−1} with repetitions allowed; we are to rearrange them, using as few swaps of adjacent elements as possible, into an order such that all the like numbers are grouped together. It is known that this problem is NP-hard. We present a probabilistic analysis of a grouping algorithm calledMEDIAN that works by sorting the numbers in the sequence according to their median positions. Our results show that the expected behavior ofMEDIAN is within 10% of optimal and is asymptotically optimal asn/m→∞ or asn/m→0.

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. Feller, W.,An Introduction to Probability Theory and Its Applications, Vol. 1, 3rd edn., Wiley, New York, 1968.

    Google Scholar 

  2. Garey, M. R., and D. S. Johnson,Computers and Intractability: A Guide to the Theory of NP-Completeness, Freeman, San Francisco, 1979.

    MATH  Google Scholar 

  3. Howell, T. D., Grouping by swapping is NP-Complete, unpublished manuscript, 1977.

  4. Parlett, B., A Recurrence Among the Elements of Functions of Triangular Matrices,Linear Algebra and Its Applications,14 (1976), 117–121.

    Article  MATH  MathSciNet  Google Scholar 

  5. Reingold, E. M., J. Nievergelt, and N. Deo,Combinatorial Algorithms: Theory and Practice, Prentice-Hall, Englewood Cliffs, NJ, 1977.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Additional information

Communicated by D. T. Lee.

The work of this author was supported in part by the Texas Advanced Research Program under Grant 4096.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Wong, D.F., Reingold, E.M. Probabilistic analysis of a grouping algorithm. Algorithmica 6, 192–206 (1991). https://doi.org/10.1007/BF01759041

Download citation

  • Received:

  • Revised:

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF01759041

Key words

Navigation