algoritmy0599

Bubble sort

May 30th, 2019
534
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. public void seradPodleCasu() {
  2. if (this.zavodnici == null) return;
  3.  
  4. for (int i = 0; i < this.zavodnici.length - 1; i++) {
  5. for (int j = 0; j < this.zavodnici.length - i - 1; j++) {
  6. if (this.zavodnici[j].getCelkovyCas() > this.zavodnici[j+1].getCelkovyCas()) {
  7. Zavodnik pom = this.zavodnici[j];
  8. this.zavodnici[j] = this.zavodnici[j+1];
  9. this.zavodnici[j+1] = pom;
  10. }
  11. }
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment