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;
for (let x = numberPool; x >= 0; x--) {
if (x % 2 === 0) {
myArray.push(x);
}
}
for (let x = numberPool; x >= 0; x--) {
if (x % 3 === 0) {
myArray.push(x);
}
}
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);