You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
1003 B

<html><body><pre><script>
var tab = [32,12,234,98,6,8,29,15,1053,14,34];
document.write("\ntrier un tableau par bulle");
document.write("\n"+tab.toString());
/*
pour i=11; i > 0; i--
pour j=0; j < i; j++
pour j allant de 0 à i-1
si tab[j+1] < tab[j]
tmp = tab[j+1];
tab[j+1] = tab[j];
tab[j] = tmp;
fin si
fin pour
fin pour
*/
for( i = tab.length ; i>0 ; i-- ) {
for( j=0 ; j < i-1 ; j++ ) {
if( tab[j+1] < tab[j]) {
var tmp = tab[j+1];
tab[j+1] = tab[j];
tab[j] = tmp;
//document.write("\n"+tab.toString());
}
}
//document.write("\n"+tab.toString());
}
document.write("\n"+tab.toString());
</script></pre><body></html>