Probabilistic analysis of a grouping algorithm

D. F. Wong*, Edward M. Reingold

*Corresponding author for this work

Research output: Contribution to journalJournal articlepeer-review

2 Citations (Scopus)


We study the grouping by swapping problem, which occurs in memory compaction and in computing the exponential of a matrix. In this problem we are given a sequence of n 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 called MEDIAN that works by sorting the numbers in the sequence according to their median positions. Our results show that the expected behavior of MEDIAN is within 10% of optimal and is asymptotically optimal as n/m→∞ or as n/m→0.

Original languageEnglish
Pages (from-to)192-206
Number of pages15
Issue number1-6
Publication statusPublished - Jun 1991

Scopus Subject Areas

  • Computer Science(all)
  • Computer Science Applications
  • Applied Mathematics

User-Defined Keywords

  • Exponential of a matrix
  • Grouping by swapping
  • Memory compaction
  • Probabilistic analysis of algorithms


Dive into the research topics of 'Probabilistic analysis of a grouping algorithm'. Together they form a unique fingerprint.

Cite this