Bubble Sort

Bubble Sort compares two adjacent elements in each pass and re-array sorted elements from the highest index position.

function bubbleSort(list) {
	var c = list.length-1;
	do {
		for(var i=0; i<c; i++) {
			if(list[i] > list[i+1]) {
				var t = list[i];
				list[i] = list[i+1];
				list[i+1] = t;
	    	} 
		}
		c-=1
	} while (c !== 1)
	return list;
}