Bubble Sort

Python

def bubbleSort(list):
    for i in range(len(list)):
        for j in range(1, len(list)-i):
            if list[j]<list[j-1]:
                list[j], list[j-1] = list[j-1], list[j]
    return list

Java

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