package project_1;
public class SelectionSort {
public static void main(String[] args) {
// TODO Auto-generated method stub
int[] arr= {55,43,37,23,12};
SelectionSort(arr);
display(arr);
}
public static void SelectionSort(int[] arr) {
for(int counter=0;counter<arr.length-1;counter++) {
int min =counter;
for (int j=min+1; j<arr.length-1; j++){
if(arr[j]<arr[min])
{
min=j;
}
if (min !=counter)
{
int temp=arr[min];
arr[min]= arr[counter];
arr[counter]= temp;
}
}
}
}
public static void display(int[] a)
{
for(int i=0;i<a.length;i++)
System.out.print(a[i] +" ");
}
}