public class selection {
public static void main(String[] args) {
int[] arr = { 88,11 ,44 , 99 ,55};
selectionsort(arr);
display(arr);
}
public static void display(int[] arr) {
for (int val : arr) {
System.out.println(val);
}
}
public static void selectionsort(int[] arr) {
for(int counter = 0 ; counter<arr.length-1 ; counter++) {
int min = counter;
for(int i = counter+1 ; i<=arr.length-1 ; i++) {
if(arr[i] < arr[min]) {
min = i;
}
int temp = arr[min];
arr[min] = arr[counter];
arr[counter] = temp;
}
}
}
}