/**
* author Jia Xiaoping
* author Alex Rudniy
* Selection Sort
*/
class SelectionSortAlgorithm extends SortAlgorithm {
  
  void sort(int a[]) {

    int i, j;
    int min, temp;

    for (i = 0; i < a.length-1; i++) {
      min = i;
      for (j = i+1; j < a.length; j++) {
        if (a[j] < a[min])
          min = j;
      }
      temp = a[i];
      a[i] = a[min];
      a[min] = temp;	
      pause();
    }
  }

  public SelectionSortAlgorithm(AlgorithmAnimator animator) {
    super(animator); 
  }
}