Selection Sort

Python

def selectionSort(list):
    for i in range(len(list)):
        min_index=i
        for j in range(i+1, len(list)):
            if list[j]<list[min_index]:
                min_index = j
        list[min_index], list[i] = list[i], list[min_index]
    return list

Java

public void selectionSort(int[] nums){
    for(int i=0; i<nums.length; i++){
        int min_index=i;
        for(int j=i+1; j<nums.length; j++){
            if(nums[j]<nums[min_index]){
                min_index = j;
            }
        }
        int tmp = nums[min_index];
        nums[min_index] = nums[i];
        nums[i] = tmp;
    }
}