All pastes #675889 Raw Edit

Vivia

public java v1 · immutable
#675889 ·published 2007-08-30 16:09 UTC
rendered paste body
class 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] );      }    } }