/* Selectionsort array
 */
class SelectionSortAlgorithm extends SortAlgorithm
{
  public void sort(int a[]) throws Exception {
    int low;
    int k,j;
    for (int i=0;i<a.length;i++) {
      k=a.length-1;
      low=a.length*2;
      pause();
      for (j=i+1;j<a.length;j++) {
	if (a[j]<low) {
	  low=a[j];
	  k=j;
	}
      }
      a[j]=a[k];
      pause(k,j);      
    }
  }
}
