Anonymous user
Sorting algorithms/Bubble sort: Difference between revisions
Fixed Java Code
(→{{header|Eiffel}}: Removed "beta" from version 6.6) |
(Fixed Java Code) |
||
Line 845:
<lang java>do {
boolean changed = false;
for (int a = 0; a < comparable.length -
if (comparable[a].compareTo(comparable[a + 1]) > 0) {
int tmp = comparable[a];
Line 853:
}
}
} while (
For descending, simply switch the direction of comparison:
|