<< Algorithms

Insertion Sort

Canvas settings

Insertion sort blah blah blah
				function bubbleSort(arr){
	var temp;
	var swapped;

	for (var i = 0; i < arr.length; i++) {
		swapped = false;
		for (var j = 0; j < arr.length; j++) {
			if(arr[j] > arr[j + 1]){
				temp = arr[j];
				arr[j] = arr[j + 1];
				arr[j + 1] = temp;
				swapped = true;
			}
		}
		if(!swapped){
			break;
		}
	}

	return arr;
}