I have some questions about selection sort.I\'m a little bit confused.
int [] arr = {5,4,3,2,1}; // This is my array
int min = 0;
for(int i = 0;i&l
public class Selectionsort{
public static int arr[]; public static int y;
public static void main( String args[] ){
System.out.println("Enter number of element you want to enter for sorting");
int nofele= Integer.parseInt(args[0]);
System.out.println("Enter number of element entered for sorting is "+ "\n" +nofele);
arr = new int[nofele];
System.out.println("Entered array is");
for(int i=1,j=0;i<=nofele;i++,j++){
arr[j]=Integer.parseInt(args[i]);
System.out.println(arr[j]);
}
System.out.println("Sorted array for selection sort is ");
for(int k=0;k=2;l--,b++){
if(arr[k]>arr[k+b]){
int temp=arr[k];
arr[k]=arr[k+b];
arr[k+b] = temp;
}
}
System.out.println(arr[k]);
}
System.out.println(arr[nofele-1]);
}
}