v1
5/27/2019 by Skitionek 5/27/201900
Setup HTML - click to add setup HTML
disable setup JavaScript
Setup JavaScript
const bubbleSort = (a) => {
	const len = a.length;

	let sorted = false;
	while(!sorted) {
		sorted = true;
		for (let i = 0; i < len; i++) {
			let current = a[i];
			let next    = a[i + 1];

			if(next < current) {
				a[i] = next;
				a[i + 1] = current;
				sorted = false;
			}
		}
	}
};

const reversebubbleSort = (a) => {
	const len = a.length;

	let sorted = false;
	while(!sorted) {
		sorted = true;
		for ( var i = a.length; --i; ) {
			let current = a[i];
			let next    = a[i - 1];

			if(next < current) {
				a[i] = next;
				a[i - 1] = current;
				sorted = false;
			}
		}
	}
};

const reverseimprovedbubbleSort = (a) => {
	const len = a.length;

	let unsorted;
	do {
		unsorted = false;
		for ( var i = a.length -1; i; ) {
			let current = a[i--];
			let next    = a[i];

			if(next < current) {
				a[i+1] = next;
				a[i] = current;
				unsorted = true;
			}
		}
	} while (unsorted);
};

const myArray = [];
const numberPool = 4096;

// add numbers divisible by 2
for (let x = numberPool; x >= 0; x--) {
  if (x % 2 === 0) {
  myArray.push(x);
  }
}

// add numbers divisible by 3
for (let x = numberPool; x >= 0; x--) {
  if (x % 3 === 0) {
    myArray.push(x);
  }
}

// add numbers divisible by 7
for (let x = numberPool; x >= 0; x--) {
  if (x % 7 === 0) {
    myArray.push(x);
  }
}

const Int8 = new Int8Array(myArray);
const Uint8 = new Uint8Array(myArray);
const Uint8Clamped = new Uint8ClampedArray(myArray);
const Int16 = new Int16Array(myArray);
const Uint16 = new Uint16Array(myArray);
const Int32 = new Int32Array(myArray);
const Uint32 = new Uint32Array(myArray);
const Float32 = new Float32Array(myArray);
const Float64 = new Float64Array(myArray);
delete caserun single casemove downdrag and drop case


ready



bubbleSort(Int8);
delete caserun single casemove upmove downdrag and drop case


ready



bubbleSort(Uint8);
delete caserun single casemove upmove downdrag and drop case


ready



bubbleSort(Uint8Clamped);
delete caserun single casemove upmove downdrag and drop case


ready



bubbleSort(Int16);
delete caserun single casemove upmove downdrag and drop case


ready



bubbleSort(Uint16);
delete caserun single casemove upmove downdrag and drop case


ready



bubbleSort(Int32);
delete caserun single casemove upmove downdrag and drop case


ready



bubbleSort(Uint32);
delete caserun single casemove upmove downdrag and drop case


ready



bubbleSort(Float32);
delete caserun single casemove upmove downdrag and drop case


ready



bubbleSort(Float64);
delete caserun single casemove upmove downdrag and drop case


ready



bubbleSort(myArray);
delete caserun single casemove upmove downdrag and drop case


ready



reversebubbleSort(myArray);
delete caserun single casemove upmove downdrag and drop case


ready



reversebubbleSort(Int32);
delete caserun single casemove upmove downdrag and drop case


ready



reverseimprovedbubbleSort(myArray);
delete caserun single casemove updrag and drop case


ready



bubbleSort(myArray);
Test Case - click to add another test case
Teardown JS - click to add teardown JavaScript
Output (DOM) - click to monitor output (DOM) while test is running
RUN