i searched all over the internet and i can only find it in java, which i have no clue about since i am in grade 10 and i just started this course.
i do understand how it works as well as the advantage over the normal bubble sort, etc.
i just need help writing it in code!!!
i have this as my bubblesort function:
function myBubbleSort(arrayName,length)
{
for(var i=0; i<(length-1);i++)
{
for(var j=i+1; j<length; j++)
{
if(arrayName[j] <arrayName[i])
{
var dummy=arrayName[i];
arrayName[i]=arrayName[j]
arrayName[j]=dummy;
}
}
}
}
i am guessing that i just need to convert that into bidirectional bubble sort, replace it with the normal bubble sort,
and fit it into the whole code.
please teach me how to write the bidirectional bubble sort function!!!!!

New Topic/Question
Reply



MultiQuote



|