/*
 * file: ~/public_html/java/ExchangeSortAlgorithm.java
 *
 * Created by Ola Martensson, dat92omaludat.lth.se
 *
 * Time-stamp: <96/03/07 10:28:46 dat92oma@ludat.lth.se>
 *
 *
 * Quick hack to implement the n^2 algorithm "Exchange sort"
 */
class ExchangeSortAlgorithm extends SortAlgorithm
{
  void sort(int a[]) throws Exception {
    pause();
    for (int i=0;i<a.length-1;i++)
      for (int j=i+1;j<a.length;j++)
	if (a[j]<a[i]) {
	  int k=a[i];
	  a[i]=a[j];
	  a[j]=k;
	  pause(i,j);
	}
  }
}
