he creado este código, pero no se si lo tengo bien:
function bs(arr, first, second){
var temp = arr[first];
arr[first] = arr[second];
arr[second] = temp;
}
function bso(arr){
var leng = arr.length,
i, x, stop;
var pares;
var impares;
for (i=0; i<leng; i++){
for (x=0, stop=leng-i; x<stop; x++){
if (arr[x]>arr[1+x]){
bs(arr, x, 1+x);
if (i%2!=0) {
pares.add(arr);
} else {
impares.add(arr);
}
}
}
}
return arr;
}
document.getElementById("burbuja").innerHTML = bso([82, 52, 5, 8, 100, 67]);
document.getElementById("par").innerHTML = pares;
document.getElementById("impar").innerHTML = impares;
<h1>Orden Normal:</h1>
<h1 id="burbuja"></h1>
<br>
<h1>Números Pares:</h1>
<h1 id="par"></h1>
<br>
<h1>Números Impares:</h1>
<h1 id="impar"></h1>