Difference between revisions 706976 and 853688 on plwikisource

{{Nagłówek
|tytuł=Sortowanie bąbelkowe
|sekcja=Kod źródłowy
|adnotacje={{Wikipedia|strona=Sortowanie bąbelkowe|dopełniacz=Sortowanie bąbelkowe}}
}}
{{Spis treści}}
==BASH==
* <tt>$lz</tt> - ilość liczb do posortowania
(contracted; show full)  }
  while (l < p);
}
</source>

== Java ==
<source lang="java">
    public 
iInteger[] bubbleSort(Integer[] a) {
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < a.length - 1; j++) {
                if (a[j] > a[j + 1]) {
                    int temp;
                    temp = a[j + 1];
                    a[j + 1] = a[j];
                    a[j] = temp;
                }
            }
        }
    return a;
    }
</source>

== Java (minimalizacja LOC) ==
<source lang="java">
    public void bubbleSort(Integer[] a) {
        for (int i = 0, size = a.length - 1; i < a.length - 1; i++, size--)
            for (int j = 0; j < size; j++)
                for (int temp = a[j]; a[j] > a[j + 1]; a[j] = a[j + 1], a[j + 1] = temp) ;
    }
</source>

[[Kategoria:Kody źródłowe]]