Someone
public text v1 · immutablepublic class bubbleSort
{
public static void main(String[] args)
{
int numItems = list.length;
boolean notSorted = true;
while (notSorted && (numItems >= 2))
{
notSorted = false;
for (int i = 0; i < numItems - 1; ++i)
{
if( list[i] > list[i+1])
{
swapArrayItems(list, i, i+1);
//a swap occurred so possibly not sorted
notSorted = true;
}
}
--numItems
}
}
}