Selection Sort
      In selection sort we select an item i.e. minimum aur maximum and sort it by placing it in the first or last position.This process is repeated until the whole array is sorted. The time required is O(n^2).
public class SelectionSort{
	public static void main(String args[]){
		int num[]={44,22,33,34,25}; //any arbit array of number, u can change its length
		
		//Sorting Algorithm Start
		int min;
		for(int i=0; i<(num.length-1); i++){
			min=i;
			for(int j=i+1; j<num.length; j++){
				if(num[min]>num[j])		//check if value at min index is greater then its value is updated
					min=j;
			}
			if (min!=i){	//swapping if minimum is not equal to current number index, i.e. i
				int temp = num[i];
				num[i] = num[min];
				num[min] = temp;
			}
		}
		//Sorting Algorithm Ends
		
		System.out.print("Sorted:  ");
		for(int i=0; i<num.length; i++){
			System.out.print(num[i] + "  ");
		}
	}
}									

Download Program
Did You Know ?
IP address is a numerical label that is assigned to devices participating in a computer network. Read More