|
|
Description
This applet demonstrates the working of the Selection Sort algorithm.
Code
|
public void selectionSort(){ int i,j,min,temp; for(j=0; j < size-1; j++){ min=j; for(i=j+1; i < size; i++) if(arr[i] < arr[min]) min=i; if(j!=min){ temp=arr[j]; arr[j]=arr[min]; arr[min]=temp; } } } |