Vivia
public java v1 · immutableclass SelectionSortAlgorithm { void sort(int a[]) throws Exception { for (int i = 0; i < a.length; i++) { int min = i; int j; //find the smallest element in the unsorted list for (j = i + 1; j < a.length; j++) { if (a[j] < a[min]) { min = j; } }//Swap the smallest unsorted element into the end of the sorted list. swap ( a[i], a[min] ); } } }