## Abstract

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 language | English |
---|---|

Pages (from-to) | 192-206 |

Number of pages | 15 |

Journal | Algorithmica |

Volume | 6 |

Issue number | 1-6 |

DOIs | |

Publication status | Published - 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